CN101446920A - Data-writing method deciding flash memory by employing file system characteristics - Google Patents

Data-writing method deciding flash memory by employing file system characteristics Download PDF

Info

Publication number
CN101446920A
CN101446920A CNA2008101906408A CN200810190640A CN101446920A CN 101446920 A CN101446920 A CN 101446920A CN A2008101906408 A CNA2008101906408 A CN A2008101906408A CN 200810190640 A CN200810190640 A CN 200810190640A CN 101446920 A CN101446920 A CN 101446920A
Authority
CN
China
Prior art keywords
data
mentioned
flash memory
file system
subregion
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
CNA2008101906408A
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.)
Xiangshuo Science & Technology Co Ltd
Asmedia Technology Inc
Original Assignee
Xiangshuo Science & Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xiangshuo Science & Technology Co Ltd filed Critical Xiangshuo Science & Technology Co Ltd
Priority to CNA2008101906408A priority Critical patent/CN101446920A/en
Publication of CN101446920A publication Critical patent/CN101446920A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to a data writing method deciding flash memory by employing file system characteristics which comprises the following steps: obtaining the data initial position of a data area in a first subarea in the flash memory; converting the data initial position into a first area block code and a first page code; when the first page code is an not an integer, calculating offset and adding the first page code to obtain an updated first page; and setting a new data initial position of the data area as the first area block code and the updated first page to lead a first data to be written according to the new data initial position. When the data initial position of one subarea in the flash memory is not aligned with a page; the FTL adds the data initial position with one offset to lead the data written into the memory flash to be written from the initial position of one page and effectively improve the memory efficiency of the flash memory.

Description

Utilize the method for writing data of file system characteristics decision flash memory
Technical field
The present invention relates to a kind of method for writing data of flash memory, relate in particular to a kind of method for writing data that utilizes the file system characteristics decision flash memory in the operating system.
Background technology
As everyone knows, flash memory (flash memory) have shock resistance (shock), non-volatile (nonvolatile), with advantage such as high storage density.Therefore, the flash memory collocation formed flash memory devices of control circuit (flashmemory storage device) is used widely.For example, thumb (thumb drive), compact flash memory storage (compact flash, abbreviation CF card), safety digital storage device (secure digital is called for short the SD card), multimedia card memory storage (multi media card is called for short mmc card) or the like.
As everyone knows, the data space of flash memory is made up of a plurality of blocks (block), and a plurality of pages or leaves (page) are arranged in each block.Moreover the base unit of the each access of flash memory (access) is one page, and data must be that unit carries out block erase (erase block) with a block when erasing.That is to say that flash memory has block erases and whole page of characteristic that writes, and must be write in regular turn toward high number of pages (high page number) by low number of pages (low pagenumber) when flash memory writes data.
Moreover at present employed file system (file system) all is in the characteristic of hard disk (hard disk) mode as access in the operation system of computer (operation system is called for short OS).The most normal now file system kenel of seeing has, file configuration table 12 file system (file allocation table 12 filesystem, hereinafter to be referred as FAT12), file configuration table 16 file system (file allocation table 16 filesystem, hereinafter to be referred as FAT16), file configuration table 32 file system (file allocation table 32 filesystem, hereinafter to be referred as FAT 32), New Technology File System (new technology file system, hereinafter to be referred as NTFS), (the second extended file system of the second extended file system, hereinafter to be referred as EXT2), perhaps the 3rd extended file system (third extended file system is hereinafter to be referred as EXT3).In general, FAT 12/16/32 and NTFS are used in Windows, and EXT2 and EXT3 are to use in (SuSE) Linux OS.
For instance, please refer to Figure 1A, it is depicted as the subregion synoptic diagram that known computer operating system is done at hard disk.At first, operating system can be according to user's the sector that is set in hard disk 0 (sector0), set up a main start magnetic region (master boot record, under be called for short MBR) its capacity is M sector, and in main start magnetic region the main partition table of a disk (disk primary partition table) arranged.The information that writes down in the main partition table of disk is as follows: (1) hard disk has what subregions (partition); (2) the file system kenel (type) of each subregion and capacity (size); (3) the pairing subregion reference position of each subregion; (4) operating system is at the sector location (sector unit) of each section post management.Wherein, each sector is defined as 512 bytes (byte).
Suppose that the user utilizes disk partition program (for example FDISK) to carry out the subregion of hard disk, and be C dish and D dish fdisk.Wherein, the file system kenel of C dish is FAT 32, and the file system kenel of D dish is NTFS.Therefore, the main partition table of the disk among the MBR can be put down in writing this hard disk and have 2 subregions, and the kenel of first subregion is that FAT 32 capacity are A sector and the kenel of second subregion is B sector for the NTFS capacity.And the subregion reference position of first subregion is that (sector a), the subregion reference position of second subregion is sector b (sector b) to sector a.Moreover the sector location that operating system is managed at FAT 32 is 16K bytes (32 sector); At the sector location that NTFS managed is 4K bytes (8 sectors).
Moreover, after two subregions all format (format) and finish, also can set up admin table (management table) in each subregion, the admin table in first subregion is called FAT table, and (sector a) begins, and its capacity is E sector by the sector a of first subregion; Moreover the admin table in second subregion is called NTSC table, and is begun by the sector b (sector b) of second subregion, and its capacity is F sector.
Therefore, by Figure 1A as can be known, the data reference position of actual data field is sector e[sector e=sector (a+E) in first subregion]; The data reference position of actual data field is sector f[sector f=sector (b+F) in second subregion].Moreover, because FAT 32 sector location of being managed is 16Kbytes (32 sector), so the data field in first subregion can be that unit is cut into a plurality of data subarea with the data field and is managed by FAT table with 16k bytes; In like manner, because sector location that NTFS managed is 4K bytes (8 sector), so the data field in second subregion can be that unit is cut into a plurality of data subarea with the data field and is managed by NTSC table with 4k bytes.
By Figure 1A as can be known, the initial sector in a plurality of data subarea in first subregion is sector e, sector e+32, sector e+64, sector e+96 ... the rest may be inferred; The initial sector in the data subarea in second subregion is sector f, sector f+8, sector f+16, sector f+24 ... the rest may be inferred.Moreover when main frame sent read write command, its writing position must be that the initial sector by the data subarea begins.
For instance, please refer to Figure 1B, it is depicted as the synoptic diagram that main frame writes data.Main frame is that first file 100 of 8K bytes is when writing the data field of first subregion with a file size, this first file 100 can write arbitrarily the data subarea and must be begun by the initial sector in data subarea to write, for example, sector (e+32) [sector (e+32)].By Figure 1B as can be known, first file 100 is begun to write by sector (e+32) [sector (e+32)], when first file 100 write finish after, the remaining space in this data subarea can't write other data again.
In like manner, main frame is that second file 200 of 7K bytes is when writing the data field of second subregion with a file size, this second file 200 can write arbitrarily the data subarea and must be begun by the initial sector in data subarea to write, for example, and by sector (f+8) [sector (f+8)].By Figure 1B as can be known, second file 200 is begun to write by sector (f+8) [sector (f+8)], and writes two data subareas.Wherein, first data subarea does not have remaining space, and next data area has remaining space, and in like manner, the remaining space in this next data subarea can't write other data again.
Main frame is to the data writing mode of hard disk as shown in the above description.Yet, when hard disk is replaced into flash memory, because the block of flash memory is erased and whole page of characteristic that writes.Therefore, if when directly directly applying mechanically above-mentioned method for writing data to flash memory, will cause the efficient that writes of flash memory to reduce.
Summary of the invention
In view of this, the object of the present invention is to provide a kind of method for writing data that utilizes file system characteristics decision flash memory, to improve the defective of prior art.
The present invention proposes a kind of method for writing data that utilizes file system characteristics decision flash memory, comprises the following step: a data reference position that obtains the data field in one first subregion in the flash memory; This data reference position is converted to the one first block sign indicating number and one first page number; When this first page number is non-integer, calculates a side-play amount and add that this first page number becomes one and upgrades first page number; And a new data reference position of setting this data field first block sign indicating number is for this reason upgraded first page number therewith, makes one first data to write first data according to this new data reference position.
The method for writing data that utilizes file system characteristics decision flash memory of the present invention, when a data reference position in the subregion in the flash memory and a page or leaf and when not lining up, FTL adds a side-play amount with this data reference position, make the data that write flash memory all can begin by the reference position of a page or leaf to write, and make the access usefulness of flash memory improve effectively.
Description of drawings
The present invention must be by following accompanying drawing and explanation, to obtain a more deep understanding:
Figure 1A is depicted as the subregion synoptic diagram that known computer operating system is done at hard disk.
Figure 1B is depicted as the synoptic diagram that main frame writes data.
Figure 2 shows that the subregion synoptic diagram of flash memory.
Figure 3 shows that the present invention utilizes the method for writing data of file system characteristics decision flash memory.
Figure 4 shows that the synoptic diagram in the data field and the data subarea of flash memory.
Figure 5 shows that main frame writes the synoptic diagram of data
Embodiment
As everyone knows, flash memory has block erases and whole page of characteristic that writes, and must be write in regular turn toward high number of pages by low number of pages when flash memory writes data.And the flash translation layer (FTL) in the flash memory (flash translationlayer is hereinafter to be referred as FTL) is understood the write command that main frame is sent and write data through after adjusting, and is that unit writes in the flash memory with the page or leaf.Wherein, FTL is arranged in flash memory, and it can be realized by the quickflashing controller in the flash memory.
A block supposing each flash memory comprises 8 pages or leaves (the 0th page~the 7th page), and the capacity of each page is 4K byte (byte).Therefore, FTL can be to carry out writing of data again after the position of unit is converted into the position of block and page or leaf with sector (sector) with host computer side send.Also promptly, when FTL receives sector x (sector x), x is the block sign indicating number divided by 64 resulting quotients, and remainder is the page number divided by 8 again.For instance, when x=273,273/64 quotient is 4, and remainder is 17; And 17/8=2+1/8.That is to say that sector 273 (sector 273) can be exchanged into second page 1/8 place of flash memory the 4th block.That is to say that the sector position that host computer side sent all can be converted to the position of corresponding block and page or leaf by FTL.
That is to say that the user utilizes disk partition program (for example FDISK) when carrying out the subregion of flash memory under operating system, all sector positions all can be converted to the position of corresponding block and page or leaf by FTL.And when flash memory after format is finished, also have the admin table in MBR and each subregion in the whole flash memory.
For instance, please refer to Fig. 2, it is depicted as the subregion synoptic diagram of flash memory.Suppose that it is two with flash partition that the user utilizes disk partition program (for example FDISK).And the kenel of first subregion is FAT 32 capacity is AA sector and the kenel of second subregion is BB sector for the NTFS capacity.And the subregion reference position of first subregion is sector aa (sector aa), and the subregion reference position of second subregion is sector bb (sector bb).Moreover the sector location that operating system is managed at FAT 32 is 16Kbytes (32 sector); At the sector location that NTFS managed is 4K bytes (8 sectors).And above information will be recorded among the MBR, and the capacity of MBR is the MM sector.
In like manner, when two subregions all format finish after, also can set up admin table in each subregion, the admin table in first subregion is called FAT table, and is begun by the sector aa of first subregion, its capacity is EE sector; Moreover the admin table in second subregion is called NTSC table, and is begun by the sector bb of second subregion, and its capacity is FF sector.Wherein, the size of admin table is relevant with the type of file system, and it is by the specifications of each other file system (specification) institute standard.And, can calculate the actual size of admin table (EE sector or FF sector) according to specifications.
Therefore, as shown in Figure 2, the data reference position of actual data field is sector ee[sector ee=sector (aa+EE) in first subregion]; The data reference position of actual data field is sector ff[sector ff=sector (bb+FF) in second subregion].And above-mentioned position all can be converted into the block sign indicating number and the page number, that is to say, sector 0 (sector 0) is convertible into is the 0th block, the 0th page (0,0); It is the a1 block that sector aa (sectoraa) is convertible into, and the a3/8 position in the a2 page or leaf (a1, a2+a3/8); It is the e1 block that sector ee (sectoree) is convertible into, and the e3/8 position in the e2 page or leaf (e1, e2+e3/8); It is the b1 block that sector bb (sectorbb) is convertible into, and the b3/8 position in the b2 page or leaf (b1, b2+b3/8); And it is the f1 block that sector ff (sector ff) is convertible into, and the f3/8 position in the f2 page or leaf (f1, f2+f3/8).
According to embodiments of the invention, after the user finished the flash memory format, before data began to write, FTL can detect the data reference position of data field in each subregion earlier.When data reference position and page or leaf and non-alignment (align), then the data reference position is added a side-play amount (offset), make data reference position and a page alignment.
Please refer to Fig. 3, it is depicted as the method for writing data that the present invention utilizes file system characteristics decision flash memory.At first, the FTL partition information that reads flash memory is learnt a subregion reference position (S10) of the employed file system kenel of first subregion and this first subregion; Then, learn in this first subregion the admin table size and and then obtain a data reference position (S20) of a data field in first subregion; Change this data reference position and become a block sign indicating number and a page number (S30); When the page number is integer (S40), then finish (S60); When the page number is not integer (S40), provide a side-play amount to the page number to make that the page number that upgrades is an integer (S50).
By step of the present invention as can be known, when data reference position process conversion its page number of back and non-integer, FTL can increase by a side-play amount, makes that the page number after upgrading is an integer.(e1 e2+e3/8) is example, and then the page number is a non-integer when e3 is not 0, so the size of side-play amount is (8-e3)/8 page or leaf, is exactly [(8-e3) * 4K (bytes)/8] with data reference position actual in first subregion.
Please refer to Fig. 4, it is depicted as the synoptic diagram in the data field and the data subarea of flash memory.Wherein, (e1, page number e2+e3/8) are non-integer to the data reference position of reality in first subregion, and therefore the size of first side-play amount 300 is (8-e3)/8 page or leaf, is exactly [(8-e3) * 4K (bytes)/8], and the page number that upgrades is (e2+1).In like manner, (f1, page number f2+f3/8) are non-integer to the data reference position of reality in second subregion, and therefore the size of second side-play amount 400 is (8-f3)/8 page or leaf, is exactly [(8-t3) * 4K (bytes)/8], and the page number that upgrades is (f2+1).
Clearly, first side-play amount 300 that FTL provided and second side-play amount 400 can make the data reference position in win subregion and second subregion align mutually with page or leaf in the flash memory.Moreover the sector location that FAT 32 is managed in first subregion is 16K bytes (32 sectors equals 2 pages), so the data field in first subregion can be that unit is cut into a plurality of data subarea with the data field and is managed by FAT table with 16K bytes; In like manner, because sector location that NTFS managed is 4K bytes (8 sectors equals one page), so the data field in second subregion can be that unit is cut into a plurality of data subarea with the data field and is managed by NTSC table with 4k bytes.
As shown in Figure 4, when the data reference position of each subregion and a page alignment, in this subregion the reference position in all data subareas also can with a page alignment.So, the reference position in the data subarea in first subregion be (e1, e2+1), (e1, e2+3), (e1, e2+5), (e1, e2+7) ... the rest may be inferred; In like manner, the reference position in the data subarea in second subregion be (f1, f2+1), (f1, f2+2), (f1, f2+3), (f1, f2+4) ... the rest may be inferred.
Please refer to Fig. 5, it is depicted as the synoptic diagram that main frame writes data.According to embodiments of the invention, the write command of sending in the operating system of host computer side still is unit with the sector, and FTL must convert the block sign indicating number and the page number to and add side-play amount after receiving the writing position of write command, make writing position certain with a page alignment, therefore, data must be begun by the reference position of a page or leaf to write.Suppose, main frame is that first file 510 of 8K bytes writes first subregion with a file size, when writing position is the data subarea of sector (ee+32) [sector (ee+32)], FTL can add this sector (ee+32) [sector (ee+32)] and can obtain the block sign indicating number after first side-play amount 300 and the conversion and the page number is the e1 block, (e2+3) page or leaf (e1, e2+3).Therefore, first file 510 is by the e1 block, and (e1 e2+3) begins to write (e2+3) page or leaf.When first file 510 write finish after, the remaining space in this data subarea can't write other data again.
In like manner, main frame is that second file 520 of 7K bytes writes second subregion with a file size, when writing position is the data subarea of sector (ff+8) [sector (ff+8)], FTL can add this sector (ff+8) [sector (ff+8)] and can obtain the block sign indicating number after second side-play amount 400 and the conversion and the page number is the f1 block, (f2+2) page or leaf (f1, f2+2).Therefore, second file 520 is by the f1 block, and (f1 f2+2) begins to write (f2+2) page or leaf.When second file 520 write finish after, first data subarea does not have remaining space, and next data area has remaining space, in like manner, the remaining space in this next data subarea can't write other data again.
Therefore, advantage of the present invention is to propose a kind of method for writing data that utilizes file system characteristics decision flash memory, when a data reference position in the subregion in the flash memory and a page or leaf and when not lining up, FTL adds a side-play amount with this data reference position, make the data that write flash memory all can begin by the reference position of a page or leaf to write, and make the access usefulness of flash memory improve effectively.
Comprehensive above technical descriptioon; the method for writing data of file system characteristics decision flash memory that utilizes of the present invention has solved the defective that is produced in the prior art really; and then finish the development topmost purpose of the present invention; moreover; the present invention must be appointed by those of ordinary skills and executes that the craftsman thinks and be to modify the right neither claimed scope of claims of taking off as all.

Claims (7)

1. a method for writing data that utilizes file system characteristics decision flash memory is characterized in that, comprises the following step:
Obtain the data reference position of the interior data field of first subregion in the above-mentioned flash memory;
Above-mentioned data reference position is converted to the first block sign indicating number and first page number;
When above-mentioned first page number is non-integer, calculates side-play amount and add that above-mentioned first page number becomes renewal first page number; And
The new data reference position of setting above-mentioned data field is the above-mentioned first block sign indicating number and above-mentioned renewal first page number, makes the data of winning write above-mentioned first data according to above-mentioned new data reference position.
2. the method for writing data that utilizes file system characteristics decision flash memory according to claim 1 is characterized in that wherein, above-mentioned flash memory is thumb, compact flash memory storage, safety digital storage device or multimedia card memory storage.
3. the method for writing data that utilizes file system characteristics decision flash memory according to claim 1 is characterized in that, wherein, the subregion reference position of above-mentioned first subregion is recorded in the main partition table of disk in the main start magnetic region in the above-mentioned flash memory.
4. the method for writing data that utilizes file system characteristics decision flash memory according to claim 3, it is characterized in that, wherein, the sector location of above-mentioned first section post management is write down in above-mentioned main start magnetic region, makes above-mentioned data field above-mentioned data field to be divided into a plurality of data subarea according to above-mentioned new data reference position and above-mentioned sector location.
5. the method for writing data that utilizes file system characteristics decision flash memory according to claim 3, it is characterized in that, wherein, also comprise admin table in above-mentioned first subregion, make that above-mentioned data reference position is the size that above-mentioned subregion reference position adds above-mentioned admin table.
6. the method for writing data that utilizes file system characteristics decision flash memory according to claim 3 is characterized in that wherein, the file system kenel of above-mentioned first subregion is write down in above-mentioned main start magnetic region.
7. the method for writing data that utilizes file system characteristics decision flash memory according to claim 6, it is characterized in that, wherein, above-mentioned file system kenel is file configuration list file system, file configuration list file system, file configuration list file system, New Technology File System, the second extended file system or the 3rd extended file system.
CNA2008101906408A 2008-12-26 2008-12-26 Data-writing method deciding flash memory by employing file system characteristics Pending CN101446920A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNA2008101906408A CN101446920A (en) 2008-12-26 2008-12-26 Data-writing method deciding flash memory by employing file system characteristics

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNA2008101906408A CN101446920A (en) 2008-12-26 2008-12-26 Data-writing method deciding flash memory by employing file system characteristics

Publications (1)

Publication Number Publication Date
CN101446920A true CN101446920A (en) 2009-06-03

Family

ID=40742608

Family Applications (1)

Application Number Title Priority Date Filing Date
CNA2008101906408A Pending CN101446920A (en) 2008-12-26 2008-12-26 Data-writing method deciding flash memory by employing file system characteristics

Country Status (1)

Country Link
CN (1) CN101446920A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102722456A (en) * 2012-05-30 2012-10-10 深圳市江波龙电子有限公司 Flash memory device and data writing method thereof
CN103440206A (en) * 2013-07-25 2013-12-11 记忆科技(深圳)有限公司 Solid state hard disk and mixed mapping method of solid state hard disk
CN111158609A (en) * 2019-12-31 2020-05-15 广州鼎甲计算机科技有限公司 Data storage method and device, computer equipment and storage medium

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102722456A (en) * 2012-05-30 2012-10-10 深圳市江波龙电子有限公司 Flash memory device and data writing method thereof
CN102722456B (en) * 2012-05-30 2015-02-04 深圳市江波龙电子有限公司 Flash memory device and data writing method thereof
CN103440206A (en) * 2013-07-25 2013-12-11 记忆科技(深圳)有限公司 Solid state hard disk and mixed mapping method of solid state hard disk
CN103440206B (en) * 2013-07-25 2016-06-01 记忆科技(深圳)有限公司 A kind of solid state hard disc and mixed-use developments method thereof
CN111158609A (en) * 2019-12-31 2020-05-15 广州鼎甲计算机科技有限公司 Data storage method and device, computer equipment and storage medium
CN111158609B (en) * 2019-12-31 2020-11-20 广州鼎甲计算机科技有限公司 Data storage method and device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
EP1920317B1 (en) Mass data storage system
US8312554B2 (en) Method of hiding file at data protecting mode for non-volatile memory module, memory controller and portable memory storage apparatus
US8230160B2 (en) Flash memory storage system and flash memory controller and data processing method thereof
JP5295778B2 (en) Flash memory management method
TWI515735B (en) Data erasing method, memory control circuit unit and memory storage apparatus
TWI425355B (en) Data access method, memory controller, memory storage system
KR101447188B1 (en) Method and apparatus for controlling I/O to optimize flash memory
KR100703807B1 (en) Method and apparatus for managing block by update type of data in block type memory
US20100169556A1 (en) Nonvolatile storage device, information recording system, and information recording method
US9389998B2 (en) Memory formatting method, memory controller, and memory storage apparatus
JP2008545202A (en) Method and system for managing partitions in a storage device
CN113490922B (en) Write amplification optimization method for solid state disk
CN107665097B (en) Method and device for partitioning solid state disk and computer readable storage medium
US20120089765A1 (en) Method for performing automatic boundary alignment and related non-volatile memory device
US20130275655A1 (en) Memory management method and memory controller and memory storage device using the same
KR20090108694A (en) Use of a direct data file system with a continuous logical address space interface
KR20090108695A (en) Managing a lba interface in a direct data file memory system
CN103389941B (en) Storer formatting method, Memory Controller and memory storage apparatus
CN102375781B (en) Data protecting method, memory controller and portable memory storage device
CN101446920A (en) Data-writing method deciding flash memory by employing file system characteristics
US9146861B2 (en) Memory address management method, memory controller and memory storage device
US20100169555A1 (en) Method of writing data into flash memory based on file system
CN112825025A (en) Controller and operation method thereof
CN102063381B (en) Data writing method for flash memory, and controller and storage system thereof
CN114518840A (en) Controller and operation method thereof

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

Open date: 20090603