CN103092896A - File reading method - Google Patents

File reading method Download PDF

Info

Publication number
CN103092896A
CN103092896A CN2011103527094A CN201110352709A CN103092896A CN 103092896 A CN103092896 A CN 103092896A CN 2011103527094 A CN2011103527094 A CN 2011103527094A CN 201110352709 A CN201110352709 A CN 201110352709A CN 103092896 A CN103092896 A CN 103092896A
Authority
CN
China
Prior art keywords
file
read
physical blocks
document
address
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.)
Pending
Application number
CN2011103527094A
Other languages
Chinese (zh)
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.)
Inventec Corp
Original Assignee
Inventec Corp
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 Inventec Corp filed Critical Inventec Corp
Priority to CN2011103527094A priority Critical patent/CN103092896A/en
Publication of CN103092896A publication Critical patent/CN103092896A/en
Pending legal-status Critical Current

Links

Images

Abstract

A file reading method is used for reading files of hard disks. The files correspond to a plurality of physical blocks in hard disks. The file reading method comprises detecting file system types of hard disks; reading address information of the files according to the file system types; obtaining a plurality of physical block addresses corresponding to the physical blocks according to the address information; sequencing the physical block addresses to obtain a physical address table, wherein the physical block addresses in the physical address table are arranged in an increasing or decreasing sequence; and reading the physical blocks of the files through a first reading means according to the physical address table.

Description

The read method of file
Technical field
The present invention relates to a kind of read method of file, particularly a kind of read method that can improve the file of reading rate.
Background technology
Along with the fast development of the universal and network technology of computing machine, the technology of hard disk is development thereupon also.Have at least one disk (disk) in general hard disk to store a large amount of files, hard disk also can read the data that are dispersed throughout on disk by the mode that moves a reading-writing arm (read write arm) and read/write head (read write head) with mechanical action.The normal heap file of various file system (file system) to preserve in the management hard disk that adopt in hard disk.For example file system can be divided into a plurality of sectors (sector) with a plurality of tracks (track) of disk, and carries out the read-write of data as unit take the sector.
During file reading, need sequentially to determine all logical block addresses of file, and logical block addresses is videoed into a plurality of physical blocks addresses, could determine disk, track and the sector at each physical blocks place of the file wanting to read.During file reading, spended time part is that mobile reading-writing arm is to be fixed on read/write head the mechanical action on particular track.The HD vendor is in order to improve read-write efficiency, mainly by improving the rotating speed of hard disk; Rotating speed is faster, and user's access data time is also just shorter.But way really can derive the negative issues such as wearing and tearing aggravation, temperature rising or noise increase thus.
Summary of the invention
The object of the present invention is to provide a kind of read method of file, reduce the mechanical action of the required mobile reading-writing arm that carries out when reading, and significantly promote reading rate.
In order to achieve the above object, the invention provides a kind of read method of file, it is in order to read at least one file of a hard disk, a plurality of physical blocks (physical block) in the corresponding hard disk of its File.The read method of file comprises: a file system type that detects hard disk; According to file system type, an address information of file reading; According to address information, obtain a plurality of physical blocks address corresponding with physical blocks; The physical blocks address sort is obtained a physical address table, wherein arranged sequentially with increasing or decreasing of the physical blocks address in physical address table; And according to physical address table, with the physical blocks of one first read means file reading.
Wherein the first read means can comprise: open a working area (buffer); According to physical address table, the corresponding logical blocks of the sequentially physical blocks of file reading, and each physical blocks that sequentially will read is inserted the working area; And with the working area the filled up data source (data source) as file.
The first read means also can comprise: accumulative total one reads timer (timer); And prescribe a time limit when timer arrival one is read when reading, with the data source of present working area as file, and reset (reset) reads timer.
File system type can be hierarchical file system (Hierarchical File System, HFS) or hierarchical file system add (Hierarchical File System Plus, HFS+), and address information for extending record (ExtRec) extension data record (extent data record) pointed.File system type can be also that (File Allocation Table 32, FAT32), and address information is file configuration table to file configuration table 32.File system type can also be New Technology File System (New Technology File System, NTFS), and address information is running table (runlist).
In addition, the read method of file also can comprise: a file size that detects file; And read greater than one when file size and prescribe a time limit, with the physical blocks of one second read means file reading.
In sum, the read method of file can reduce the mechanical action of the required mobile reading-writing arm that carries out when reading, and significantly promotes reading rate.
Describe the present invention below in conjunction with the drawings and specific embodiments, but not as a limitation of the invention.
Description of drawings
Fig. 1 one implements the process flow diagram of read method of the file of example;
Fig. 2 is the logical blocks of an enforcement example and the block diagram of physical blocks;
Fig. 3 is the process flow diagram of the first read means of an enforcement example;
Fig. 4 A-Fig. 4 D is the block diagram in the working area of an enforcement example;
Fig. 5 A-Fig. 5 D is for also one implementing the block diagram in the working area of example;
Fig. 6 is the process flow diagram of going back the first read means of an enforcement example;
Fig. 7 is and the process flow diagram of the read method of the file of an enforcement example.
Wherein, Reference numeral
20 files
The 201-205 logical blocks
30 hard disks
The 3001-3030 physical blocks
40 working areas (the first working area)
The 401-405 scratch block
41 second working areas
The 411-415 scratch block
Embodiment
Below be described in detail detailed features of the present invention and advantage in embodiment, its content is enough to make any those skilled in the art understand technology contents of the present invention and implement according to this, and content disclosed according to this instructions, claim scope and accompanying drawing, any those skilled in the art can understand purpose and the advantage that the present invention is correlated with easily.
The invention provides a kind of read method of file, it is in order to read at least one file of a hard disk.Its File comprises a plurality of logical blocks (logic block), and these logical blocks are corresponding one to one with a plurality of physical blocks (physical block) in hard disk.And each physical blocks corresponds to a physical blocks address in hard disk.
Please first with reference to Fig. 1 and Fig. 2, it is respectively a process flow diagram of read method of implementing the file of example, and the block diagram of logical blocks and physical blocks.Wherein hard disk 30 can be according to the reading-writing arm (read write arm) that a read/write head (readwrite head), connection read/write head are arranged, to read at least one disk (disk) in hard disk 30; And hard disk 30 may adopt various dissimilar file system (filesystem).In this enforcement example, suppose that file 20 comprises 5 logical blocks 201-205, and hard disk 30 comprises a plurality of physical blocks 3001-3030.Wherein logic of propositions block 201,202,203,204 and 205 corresponds to respectively physical blocks 3006,3030,3007,3024 and 3013.
Because different file system adopts diverse ways configuration file 20 in hard disk 30 separately, therefore at first need to detect a file system type (step S110) of hard disk 30.File system type can be for example hierarchical file system (Hierarchical File System, HFS), hierarchical file system adds (Hierarchical File System Plus, HFS+), file configuration table 32 (File AllocationTable 32, FAT32) or New Technology File System (New Technology File System, NTFS).
Next in order to improve reading efficiency, the read method of file first manages to obtain all physical blocks 3006,3030,3007 that file 20 answers, 3024 and 3013 physical blocks address; And just begin the content of file reading 20 after considering all physical blocks addresses.The read method of file is according to file system type, an address information (step S120) of file reading 20; Again according to address information, obtain and physical blocks 3006,3030,3007,3024 and 3013 corresponding a plurality of physical blocks addresses (step S130).But the address information that different file system is used is all different; In other words, it is different that different file system is deposited the place of physical blocks address of each file 20 correspondence.
For example when file system type was HFS or HFS+, its address information was for extending record (ExtRec) extension data record (extent data record) pointed.In more detail, in order to obtain corresponding all the physics block address of file 20, a first document identifier code (file ID) according to file 20 finds out the catalogue file record (catalog file record) in hard disk 30, then reads the field (field) of the ExRec in the catalogue file record.The file system of HFS/HFS+ can be considered as a plurality of physical blocks one data segment (data segment) and process.And in ExRec, the junior three number of record file 20 is divided other starting material reason block address and physical blocks number according to section, and wherein each initial physical blocks position is exactly above-mentioned extension data record.Read ExRec, and after significantly mechanical action moved reading-writing arm with one, the read/write head of hard disk 30 just can read all physics block address that obtain file 20 correspondences continuously according to the extension data record.
And when the file system classification was FAT32, its address information was to be a file configuration table (fileallocation table).The file system of FAT32 is safeguarded respectively a link (link) for each file 20, and all set of links are left among file configuration table.Each node (node) that wherein chains represents a physical blocks, and the ending of file 20 represents with an end of file (end of file, EOF).Therefore among step S120 and S130, can be first according to a regular description technique (the formal description technique of file 20, FDT) locating file allocation list, obtaining the initial FAT node of file 20, and search all physics block address that obtain file 20 correspondences along the link of file 20.Because all links and tubercle point all are stored in file configuration table, so the reading-writing arm of hard disk 30 need not carry out significantly mechanical action, just can obtain required physical blocks address.
Similarly, the file system of NTFS concentrates on a running table (runlist) with all physical blocks addresses.Therefore the running table can be read as address information, and mechanical action reads corresponding all the physics block address of file 20 in the situation that must not carry out significantly.
As mentioned above, when file system type is HFS, HFS+, FAT32 or NTFS, the read method of file can in the situation that significantly mobile reading-writing arm obtain corresponding all the physics block address of file 20.
After obtaining required physical blocks address, the read method of file obtains a physical address table with the physical blocks address sort, and wherein the physical blocks address in physical address table is with (the step S140) arranged sequentially of increasing or decreasing.Wherein can note down a plurality of logical block addresses of physical blocks 3006,3030,3007,3024 and 3013 physical blocks position, corresponding logical blocks in physical address table, and the length of each physical blocks.
Then according to physical address table, with the one first corresponding physical blocks 3006 of read means file reading 20,3030,3007,3024 and 3013 (step S150).Because the physical blocks address in physical address table is arranged sequentially with increasing or decreasing, therefore read physical blocks 3006,3030,3007,3024 and at 3013 o'clock with the first means, reading-writing arm only must be continuously towards the single direction continuous moving.In other words, the mechanical action during file reading 20 is suppressed in minimum degree.
Please refer to Fig. 3, it is the process flow diagram of the first read means of an enforcement example.In order to preserve all data that read in reading process, at first can open a working area (buffer) (step S210) in a memory body.The first read means is according to physical address table, the physical blocks 3006,3030,3007 of file reading 20,3024 and 3013 sequentially, and the corresponding logical blocks of each physical blocks that sequentially will read is inserted working area (step S220); Last again with the working area the filled up data source (data source) (step S230) as file 20.
Please coordinate with reference to Fig. 4 A to Fig. 4 D the working area 40 when step S220 and S230 are carried out in its expression.Working area 40 can be divided into according to the logical blocks of file 20 a plurality of scratch block 401-405.Because the read method of file is that order with increasing or decreasing reads corresponding physical blocks address, but not according to the order of logical block addresses, so scratch block 401-405 is also non-sequentially is received in.
Logical blocks 201,202,203,204 and 205 corresponds to respectively physical blocks 3006,3030,3007,3024 and 3013, therefore if when reading with the order of the physical blocks address that increases progressively, can read with physical blocks 3006,3007,3013,3024 and 3030 order.Therefore the first read means reads with logical blocks 201,203,205,204 and 202 order, and fills in scratch block 401,403,405,404 and 402 order.
In addition, the read method of file also can once read a plurality of files 20.
Please refer to Fig. 5 A to Fig. 5 D, step S220 and the S230 working area when reading simultaneously two files 20 is carried out in its expression.In this enforcement example, open the first working area 40 and one second working area 41, it corresponds respectively to two identical or different files 20, and has respectively scratch block 401-405 and 411-415.The read method of file reads the address information of two files 20, and obtains all physics block address of two files 20 according to address information.Then the physical blocks address of two files 20 is sorted to generate physical address table together, reads the physical blocks of these two files 20 for the first read means.
After the first read means reads physical blocks, need judge first it belongs to which file 20, then the data of the physical blocks that reads are write among corresponding working area 40 or 41.For example in the enforcement example in Fig. 5 A to Fig. 5 D, front 3 physical blocks that the first read means is read correspond to respectively scratch block 401,413 and 415.After all physical blocks of two files 20 all are read, then with the working area 40 and 41 filled up respectively as the data source of these two files 20.
According to also one implementing example, the first read means can safeguard that one reads timer, the situation that makes the withered grade of user to avoid reading overlong time.Please refer to Fig. 6, it is the process flow diagram of going back the first read means of an enforcement example.
The first read means is opened working area 40 (step S210); According to physical address table, the sequentially physical blocks 3006,3030,3007 of file reading 20,3024 and 3013, and each physical blocks 3006,3030,3007 that sequentially will read, 3024 and 3013 corresponding logical blocks are inserted working area 40 (step S220).The first read means simultaneously can totally read timer (step S240), to learn present how long read the time of having passed through.Often write working area 40 one time, all can judge whether read at present all physical blocks 3006,3030,3007,3024 and 3013 (step S250), and judgement is read timer and whether arrived one and read the time limit (step S260).
If all physical blocks 3006,3030,3007,3024 and 3013 have been read, just can be with the working area 40 the filled up data source (step S230) as file 20.And arrive when reading in limited time when reading timer, can present working area 40 temporarily as the data source of file 20, and timer (step S270) is read in replacement.Wherein reading the time limit can be for example 5 seconds, but and as limit.Thus, even file 20 needs greatly long reading the time because of its file size, the user also can arrive at every turn and obtain data partly when reading in limited time, and does not need witheredly to wait until that whole file 20 reads and complete.
For the read method that guarantees file has enough reading efficiencies, the enforcement example of Fig. 7 also is provided, wherein Fig. 7 implements the process flow diagram of read method of the file of example for this reason.
Different from the enforcement example of Fig. 1 be in, the enforcement example of Fig. 7 can judge whether file system type is supported (step S160), or judges whether file size reads the upper limit (step S170) greater than one.Because the file system type of HFS, HFS+, FAT32 or NTFS can guarantee to read all physical blocks addresses under the mechanical action of the reading-writing arm of minute quantity, and can guarantee the reading efficiency of the read method of file.Relative, if Extension Suite file system (extended file system, be called again Ext) etc. when noting down the file system type of physical blocks address corresponding to single file with multiple indexes (pointer) or other mode at random, because need more mechanical action and the time of cost just can obtain required physical blocks address, not supported by the read method of file.
In addition, because the first read means is that all data that read out are all existed in the middle of working area 40, therefore be more suitable for the less file of file size 20.In more detail, can be with the virtual memory body (virtual memory) in using take number percent as reading the upper limit.For example user or system can set 20% of virtual memory body with reading the upper limit.The size of supposing the virtual memory body is 1024 megabyte (MB), the first read means can't the file opening size greater than the file 20 of 204.8MB.
Relatively, when the judgement file system type is not supported, or file size reads greater than one and prescribes a time limit, can be with physical blocks 3006,3030,3007,3024 and 3013 (the step S180) of one second read means file reading 20.Can jump out the read method of file this moment, and offer the user with traditional read method file reading 20 again.
Below with a reading efficiency that reads the read method of the more traditional read method of example and file provided by the invention.
Suppose to establish hard-disk interface (interface) and be sequence advanced technology attachment 2 (Serial AdvancedTechnology Attachment 2, Serial ATA2, SATA2); External transmission speed is per second 300MB (300MB/s); Disk running speed is that per second 7200 turns; Each physical areas block size is 512 bytes (byte); And suppose that the hard disk of hard disk 30 own is temporary full, therefore do not consider its impact.The impact of moving in order to simplify read/write head in addition supposes that the physical blocks of file is all concentrated the same track (track) of the same side that is distributed in same disk.And suppose that this track has 63 physical blocks and spreads over randomly on 63 sectors (sector) of this track.
Because physical blocks spreads all at random not according to the order of logical blocks, estimate that with random fashion traditional technology that reads approximately need to spend the data that read 0.0308MB in 0.0043 second.Therefore internal transmission speed is about 0.0043 second=7MB/s of 0.0308MB ÷; And comprehensive hard disk transfer rate is (÷ (the 300MB/s+7MB/s)=6.8MB/s of 300MB/s * 7MB/s).
Relatively, because the read method of file provided by the invention only needs convenient one week of track, just can sequentially read required physical blocks with the order of increasing or decreasing.Therefore required time is the 1/7200 second time that track rotates a week; Internal transmission speed is 221.76MB/s; Comprehensive hard disk transfer rate is 127.5MB/s; Therefore efficient far beyond traditional read method.
In sum, for the file system type of supporting, the read method of file can obtain all physics block address of the file wanting to read rapidly, and with these physical blocks addresses one-tenth physical address table arranged sequentially with increasing or decreasing, then read according to physical address table.Therefore the read method of file can significantly reduce the mechanical action of the required mobile reading-writing arm that carries out when reading, and has promoted reading rate.And because the method does not require the raising disk running speed, the negative issues such as aggravation, temperature rising or noise increase of therefore can avoiding wearing and tearing traditionally.
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 work as can make 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 (7)

1. the read method of a file, in order to read at least one file of a hard disk, wherein this document to a plurality of physical blocks in should hard disk, is characterized in that, the read method of this document comprises:
Detect a file system type of this hard disk;
According to this document system type, read an address information of this document;
According to this address information, obtain a plurality of physical blocks address corresponding with those physical blocks;
Those physical blocks address sorts are obtained a physical address table, wherein arranged sequentially with increasing or decreasing of those physical blocks address in this physical address table; And
According to this physical address table, read those physical blocks of this document with one first read means.
2. the read method of file according to claim 1, is characterized in that, this first read means comprises:
Open a working area;
According to this physical address table, sequentially read those physical blocks of this document, and the corresponding logical blocks of each this physical blocks that sequentially will read is inserted this working area; And
With this working area of filling up data source as this document.
3. the read method of file according to claim 1, is characterized in that, this first read means also comprises:
Accumulative total one reads timer; And
When this read timer arrive one when reading in limited time, with the data source of this present working area as this document, and reset that this reads timer.
4. the read method of file according to claim 1, is characterized in that, this document system type is that hierarchical file system or hierarchical file system add, and this address information is for extending record extension data record pointed.
5. the read method of file according to claim 1, is characterized in that, this document system type is file configuration table 32, and this address information is file configuration table.
6. the read method of file according to claim 1, is characterized in that, this document system type is New Technology File System, and this address information is the running table.
7. the read method of file according to claim 1, is characterized in that, also comprises:
Detect a file size of this document; And
When this document size reads in limited time greater than one, read those physical blocks of this document with one second read means.
CN2011103527094A 2011-11-04 2011-11-04 File reading method Pending CN103092896A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2011103527094A CN103092896A (en) 2011-11-04 2011-11-04 File reading method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2011103527094A CN103092896A (en) 2011-11-04 2011-11-04 File reading method

Publications (1)

Publication Number Publication Date
CN103092896A true CN103092896A (en) 2013-05-08

Family

ID=48205473

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2011103527094A Pending CN103092896A (en) 2011-11-04 2011-11-04 File reading method

Country Status (1)

Country Link
CN (1) CN103092896A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108170372A (en) * 2017-12-08 2018-06-15 厦门集微科技有限公司 data processing method and device based on cloud hard disk

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1567247A (en) * 2003-07-10 2005-01-19 上海龙林通信技术有限公司 Media file memory system and fetching mode thereof
US20070033323A1 (en) * 2005-08-03 2007-02-08 Gorobets Sergey A Interfacing systems operating through a logical address space and on a direct data file basis
JP2008009926A (en) * 2006-06-30 2008-01-17 Toshiba Corp Information processing device, information processing system, and address conversion method
CN102214479A (en) * 2011-04-28 2011-10-12 深圳市同洲电子股份有限公司 Hard disk data processing method and video stream pushing server

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1567247A (en) * 2003-07-10 2005-01-19 上海龙林通信技术有限公司 Media file memory system and fetching mode thereof
US20070033323A1 (en) * 2005-08-03 2007-02-08 Gorobets Sergey A Interfacing systems operating through a logical address space and on a direct data file basis
JP2008009926A (en) * 2006-06-30 2008-01-17 Toshiba Corp Information processing device, information processing system, and address conversion method
CN102214479A (en) * 2011-04-28 2011-10-12 深圳市同洲电子股份有限公司 Hard disk data processing method and video stream pushing server

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108170372A (en) * 2017-12-08 2018-06-15 厦门集微科技有限公司 data processing method and device based on cloud hard disk

Similar Documents

Publication Publication Date Title
US11853549B2 (en) Index storage in shingled magnetic recording (SMR) storage system with non-shingled region
CN103186350B (en) The moving method of mixing storage system and hot spot data block
CN107729558B (en) Method, system and device for defragmenting file system and computer storage medium
CN103019887B (en) Data back up method and device
CN104462389B (en) Distributed file system implementation method based on classification storage
CN103699337B (en) Writing control method and system based on independent redundant array of independent disks (RAID)
CN102915278A (en) Data deduplication method
CN105573681A (en) Method and system for establishing RAID in SSD
CN105787037B (en) A kind of delet method and device of repeated data
CN101533408A (en) Processing method and processing device of mass data
CN105487823A (en) Data migration method and device
CN107608625B (en) Method for improving reading performance of fixed storage equipment
CN103324533A (en) distributed data processing method, device and system
CN104092670A (en) Method for utilizing network cache server to process files and device for processing cache files
CN104050057B (en) Historical sensed data duplicate removal fragment eliminating method and system
CN104750432A (en) Data storage method and device
CN110147203A (en) A kind of file management method, device, electronic equipment and storage medium
US9836222B2 (en) Storage apparatus, storage control method, and storage system
CN106844491B (en) Temporary data writing and reading method and device
CN106293497A (en) The recovery method of junk data and device in watt record filesystem-aware
CN109375868B (en) Data storage method, scheduling device, system, equipment and storage medium
CN107506466A (en) A kind of small documents storage method and system
Liu et al. ROCO: Using a solid state drive cache to improve the performance of a host-aware shingled magnetic recording drive
CN103078845A (en) Method for calibrating access control list (ACL), and shared storage system
CN103092896A (en) File reading method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C02 Deemed withdrawal of patent application after publication (patent law 2001)
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20130508