CN103473184A - Caching method and system for file system - Google Patents

Caching method and system for file system Download PDF

Info

Publication number
CN103473184A
CN103473184A CN201310331403XA CN201310331403A CN103473184A CN 103473184 A CN103473184 A CN 103473184A CN 201310331403X A CN201310331403X A CN 201310331403XA CN 201310331403 A CN201310331403 A CN 201310331403A CN 103473184 A CN103473184 A CN 103473184A
Authority
CN
China
Prior art keywords
file system
data
metadata
buffer memory
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.)
Granted
Application number
CN201310331403XA
Other languages
Chinese (zh)
Other versions
CN103473184B (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

Images

Landscapes

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

Abstract

The invention is applicable to the field of storage technology and provides a caching method for a file system. The caching method is implemented through a solid state disk and comprises the steps that the logic address range of metadata of the file system is configured; all IO (input/output) of a block device in which the file system is installed is obtained; whether the address range of the IO is intersected with the logic address range of the metadata or not is judged; if the address range of the IO is intersected with the logic address range of the metadata, the data of the IO are cached. The invention also correspondingly provides a caching system for the file system. Therefore, with the caching method and system for the file system, whether the captured IO data need to be cached or not is determined, and the IO processing speed of the file system is accordingly accelerated.

Description

The caching method of file system and system
Technical field
The present invention relates to technical field of memory, relate in particular to a kind of caching method and system of file system.
Background technology
Solid state hard disc (SSD) adopts flash memory as storage medium, and the relative mechanical hard disk of reading speed is faster.Solid state hard disc is without magnetic head, and seek time is almost 0.The speed that continues to write is very surprising, not only is embodied in and continues read-write above, and random read-write speed also is exceedingly fast, and the seek times of modal 7200 favourable turn tool hard disks are generally the 12-14 millisecond, and solid state hard disc can reach 0.1 millisecond even lower easily!
SSD is widely used in storage market, its application model is except the replacement as mechanical hard disk, can also be using SSD as buffer memory, normally as the buffer memory of block device (essential characteristic of block device is that each piece can be independent of other piece and read and write, and disk is modal block device).But, under this pattern, it is difficult problem which kind of data need to be stored in SSD, tracing it to its cause is that buffer memory for block device has lost application context, can't accurately find " focus " data.
In file system, metadata has recorded the information of file system and the information of file, these information can frequently be accessed by file system, this can cause a large amount of random IO, for mechanical hard disk, a large amount of random seek times will have a strong impact on disk system, thereby cause the application IO based on file system slow in reacting.
In summary, existing file caching method and system, obviously exist inconvenience and defect in actual use, so be necessary to be improved.
Summary of the invention
For above-mentioned defect, the object of the present invention is to provide a kind of caching method and system of file system, can determine whether the IO data to catching need buffer memory, thus the IO processing speed of accelerating file system.
To achieve these goals, the invention provides a kind of caching method of file system, realize by solid state hard disc, described method comprises:
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 and the ranges of logical addresses of described metadata have crossing;
If it is crossing that the ranges of logical addresses of the address realm of described IO and described metadata has, the data of the described IO of buffer memory.
According to the caching method of file system of the present invention, the ranges of logical addresses step of the metadata of the described file system of described configuration comprises:
Obtain the metadata address scope of described file system by third party's instrument;
Record the metadata address scope of described file system.
According to the caching method of file system of the present invention, the step of all IO of the described block device that obtains described file system place comprises:
Obtain described IO by the driving of revising block device described in kernel.
According to the caching method of file system of the present invention, crossing if the ranges of logical addresses of the address realm of described IO and described metadata has, the step of the data of the described IO of buffer memory comprises:
If what described IO carried is the write order of data, directly described data are write to buffer memory;
If what described IO carried is the read command of data, and hits described data in buffer memory, directly return to IO;
If what described IO carried is the read command of data, and in buffer memory miss described data, described IO is distributed to described block device, by described data Replica, and the described data that copy are written to described buffer memory when described IO returns.
The present invention also provides a kind of caching system of file system, by solid state hard disc, realizes, described caching system comprises:
The metadata configurations module, for the ranges of logical addresses of the metadata that configures described file system;
The IO acquisition module, for the IO of the block device that obtains described file system place;
Whether address judgment module, have crossing for the address realm that judges described IO and the ranges of logical addresses of described metadata;
Data cache module, have when crossing the data of the described IO of buffer memory for the ranges of logical addresses of the address realm of described IO and described metadata.
According to the caching system of file system of the present invention, caching system further comprises, the 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.
According to the caching system of file system of the present invention, described IO is obtained in the driving that described IO acquisition module is further used for by revising block device described in kernel.
According to the caching system of file system of the present invention, if described IO carries is the write order of data, data cache module directly writes buffer memory by described data;
If what described IO carried is the read command of data, and hits described data in buffer memory, directly return to IO;
If what described IO carried is the read command of data, and in buffer memory miss described data, described IO is distributed to described block device, when described IO returns, by described data Replica, described data cache module is written to described buffer memory by the described data that copy.
The present invention passes through using solid state hard disc as buffer structure, it can analyze the metadata ranges of logical addresses of obtaining block device File system, when file system has the IO order, obtain this IO of the block device at file system place, and judge whether the address realm of described IO and the ranges of logical addresses of described metadata have crossing, if have crossing, by the IO data buffer storage, otherwise directly IO is distributed to block device, whereby, the present invention can determine whether the IO data to catching need buffer memory, thus the IO processing speed of accelerating file system.
The 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 process flow diagram of the file system of one embodiment of the invention;
Fig. 3 is the IO processing flow chart of another embodiment of the present invention.
Embodiment
In order to make purpose of the present invention, technical scheme and advantage clearer, below in conjunction with drawings and Examples, the present invention is further elaborated.Should be appreciated that specific embodiment described herein, only in order to explain the present invention, is not intended to limit the present invention.
Referring to Fig. 1, the invention provides a kind of caching system of file system, this caching system 100 is by solid state hard disc (SSD) realization, and it at least comprises:
Metadata configurations module 10, for the ranges of logical addresses of the metadata that configures described file system.
Preferably, the present invention can pass through the direct configuration logic address realm of metadata of 10 pairs of file system of metadata configurations module, after also can analyzing and obtain the metadata ranges of logical addresses of file system by a default file system analysis module 11, then record the ranges of logical addresses of this metadata by metadata configurations module 10.Concrete, file system analysis module 11 can by third party's instrument as winHex, dumpe2fs etc. obtain as described in the metadata address scope of file system.
IO acquisition module 20, for the IO of the block device that obtains described file system place.
The present invention realizes catching IO by the driving of revising kernel Central Plains block device, take linux operating system as example: obtains by open original equipment file the gendisk that equipment is corresponding, then can realize by the make_request_fn function address in the request_queue in change gendisk.
Address judgment module 30, for the ranges of logical addresses of the address realm that judges described IO and described metadata, whether have crossing, if, transfer to data cache module 40 and process, otherwise directly IO is sent with charge free to block device, carry out.
Data cache module 40, have when crossing the data of the described IO of buffer memory for the ranges of logical addresses of the address realm of described IO and described metadata.
Concrete, if described IO carries is the write order of data, data cache module directly writes buffer memory by described data; If what described IO carried is the read command of data, and hits described data in buffer memory, directly return to IO; If what described IO carried is the read command of data, and in buffer memory miss described data, described IO is distributed to described block device, when described IO returns, by described data Replica, described data cache module is written to described buffer memory by the described data that copy.
In concrete application of the present invention, can use the higher data of temperature automatically be written to buffer memory, upper, while once receiving the IO read/write command of corresponding data, can directly from buffer memory, obtain these data, the processing speed of accelerating file system to IO.
Referring to Fig. 2, the invention provides a kind of caching method of file system, it is by system 100 realizations as shown in Figure 1, and system 100 is based on the framework of solid state hard disc, and the method comprises:
Step S201, configure the ranges of logical addresses of the metadata of described file system.
The present invention can be to the direct configuration logic address realm of the metadata of file system, after also can obtaining the metadata ranges of logical addresses of file system by presupposition analysis, then records the ranges of logical addresses of this metadata.Concrete, can be by third party's instrument as realizations such as winHex, dumpe2fs for the metadata logical address of file system.
Step S202, obtain the IO of the block device at described file system place.
The present invention realizes catching IO by the driving of revising kernel Central Plains block device, take linux operating system as example: obtains by open original equipment file the gendisk that equipment is corresponding, then can realize by the make_request_fn function address in the request_queue in change gendisk.
Step S203, it is crossing whether the ranges of logical addresses that judges the address realm of described IO and described metadata has, if, perform step S204, otherwise execution step S205.
Step S204, the data of the described IO of buffer memory.
Step S205, send described IO with charge free block device and process.
In concrete application of the present invention, can use the higher data of temperature automatically be written to buffer memory, upper, while once receiving the IO read/write command of corresponding data, can directly from buffer memory, obtain these data, the processing speed of accelerating file system to IO.
Referring to Fig. 3, be the IO treatment scheme that one embodiment of the invention provides, it comprises:
Step S301, it is crossing whether the ranges of logical addresses that judges the address realm of IO and metadata has, if, perform step S302, otherwise execution step S305.
Step S302, judge whether IO is read command, if perform step S303, otherwise judges that these data are as write order, and execution step S304.
Step S303, judge whether the read command data of described IO hit in buffer memory, if return to the IO order, otherwise execution step S305.
Step S304, write the IO order data in buffer memory.
Step S305, arrive target device by the IO data redirection.
Further, also comprise after step S305: when described IO returns, by described data Replica, and the described data that copy are written in buffer memory.Whereby, while again receiving the IO read command of identical data, can directly hit these data, improve IO speed.
In sum, the present invention passes through using solid state hard disc as buffer structure, it can analyze the metadata ranges of logical addresses of obtaining block device File system, when file system has the IO order, obtain this IO of the block device at file system place, and judge whether the address realm of described IO and the ranges of logical addresses of described metadata have crossing, if have crossing, by the IO data buffer storage, otherwise directly IO is distributed to block device, whereby, the present invention can determine whether the IO data to catching need buffer memory, thus the IO processing speed of accelerating file system.
Certainly; the present invention also can have other various embodiments; in the situation that do not deviate from spirit of the present invention and essence thereof; those of ordinary skill in the art are when making according to the present invention various corresponding changes and distortion, but these corresponding changes and distortion all should belong to the protection domain of the appended claim of the present invention.

Claims (8)

1. the caching method of a file system, realize by solid state hard disc, it is characterized in that, described method comprises:
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 and the ranges of logical addresses of described metadata have crossing;
If it is crossing that the ranges of logical addresses of the address realm of described IO and described metadata has, the data of the described IO of buffer memory.
2. the caching method of file system according to claim 1, is characterized in that, the ranges of logical addresses step of the metadata of the described file system of described configuration comprises:
Obtain the metadata address scope of described file system by third party's instrument;
Record the metadata address scope of described file system.
3. the caching method of file system according to claim 1, is characterized in that, the step of the IO of the described block device that obtains described file system place comprises:
Obtain described IO by the driving of revising block device described in kernel.
4. the caching method of file system according to claim 1, is characterized in that, crossing if the ranges of logical addresses of the address realm of described IO and described metadata has, and the step of the data of the described IO of buffer memory comprises:
If what described IO carried is the write order of data, directly described data are write to buffer memory;
If what described IO carried is the read command of data, and hits described data in buffer memory, directly return to IO;
If what described IO carried is the read command of data, and in buffer memory miss described data, described IO is distributed to described block device, by described data Replica, and the described data that copy are written to described buffer memory when described IO returns.
5. the caching system of a file system, realize by solid state hard disc, it is characterized in that, described caching system comprises:
The metadata configurations module, for the ranges of logical addresses of the metadata that configures described file system;
The IO acquisition module, for the IO of the block device that obtains described file system place;
Whether address judgment module, have crossing for the address realm that judges described IO and the ranges of logical addresses of described metadata;
Data cache module, have when crossing the data of the described IO of buffer memory for the ranges of logical addresses of the address realm of described IO and described metadata.
6. the caching system of file system according to claim 5, is characterized in that, described caching system further comprises, the 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.
7. the caching system of file system according to claim 5, is characterized in that, described IO is obtained in the driving that described IO acquisition module is further used for by revising block device described in kernel.
8. the caching system of file system according to claim 5, is characterized in that,
If what described IO carried is the write order of data, data cache module directly writes buffer memory by described data;
If what described IO carried is the read command of data, and hits described data in buffer memory, directly return to IO;
If what described IO carried is the read command of data, and in buffer memory miss described data, described IO is distributed to described block device, when described IO returns, by described data Replica, described data cache module is written to described buffer memory by the described data that copy.
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 true CN103473184A (en) 2013-12-25
CN103473184B 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)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107797759A (en) * 2016-09-05 2018-03-13 北京忆恒创源科技有限公司 The method, apparatus and driver of access cache information

Citations (4)

* 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
US20120246643A1 (en) * 2011-03-23 2012-09-27 Lei Chang File system for storage area network

Patent Citations (4)

* 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
US20120246643A1 (en) * 2011-03-23 2012-09-27 Lei Chang File system for storage area network

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107797759A (en) * 2016-09-05 2018-03-13 北京忆恒创源科技有限公司 The method, apparatus and driver of access cache information

Also Published As

Publication number Publication date
CN103473184B (en) 2016-08-10

Similar Documents

Publication Publication Date Title
US11868257B2 (en) Cache write overlap handling
US11314437B2 (en) Cluster based hard drive SMR optimization
US8914557B2 (en) Optimizing write and wear performance for a memory
CN105808163B (en) A method and server for accessing a shingled magnetic recording SMR hard disk
KR101663066B1 (en) Solid state memory command queue in hybrid device
CN105183374B (en) A kind of data read-write method and mainboard
KR20210096133A (en) Maintenance of write commands in zoned namespaces
CN103761056A (en) Stream data storage method in video monitoring application
CN106569732B (en) Data migration method and device
CN109814811B (en) A method for reducing the impact of NVMe SSD response delay on the writing speed of high-speed data storage devices
US20160224260A1 (en) Logical block address mapping for hard disk drives
US9213646B1 (en) Cache data value tracking
CN103985393B (en) A kind of multiple optical disk data parallel management method and device
CN107608625B (en) Method for improving reading performance of fixed storage equipment
CN106646408B (en) Radar echo simulation system and method integrating echo signal acquisition and playback
CN112799595B (en) Data processing method, device and storage medium
CN102012873B (en) Cache system of Not AND (NAND) flash memory and cache method
US10169160B2 (en) Database batch update method, data redo/undo log producing method and memory storage apparatus
Suthar et al. An approach to data recovery from solid state drive: cyber forensics
CN103473184A (en) Caching method and system for file system
CN110515861A (en) Storage device and method for processing flash command
US9842622B1 (en) Data storage device having improved read failure tolerance
Yang et al. A shingle-aware persistent cache management scheme for DM-SMR disks
US9390751B1 (en) Reducing overcounting of track-level damage caused by adjacent-track and far-track interference
TWI805937B (en) Data processing method and memory controller utilizing the same

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

Granted publication date: 20160810

CF01 Termination of patent right due to non-payment of annual fee