[go: up one dir, main page]

HK1164481A1 - Method and system for data storage - Google Patents

Method and system for data storage Download PDF

Info

Publication number
HK1164481A1
HK1164481A1 HK12104708.1A HK12104708A HK1164481A1 HK 1164481 A1 HK1164481 A1 HK 1164481A1 HK 12104708 A HK12104708 A HK 12104708A HK 1164481 A1 HK1164481 A1 HK 1164481A1
Authority
HK
Hong Kong
Prior art keywords
data
storage
page
sectors
data packet
Prior art date
Application number
HK12104708.1A
Other languages
Chinese (zh)
Other versions
HK1164481B (en
Inventor
萬紅波
万红波
Original Assignee
深圳市朗科科技股份有限公司 號朗科大廈 層
深圳市朗科科技股份有限公司
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 深圳市朗科科技股份有限公司 號朗科大廈 層, 深圳市朗科科技股份有限公司 filed Critical 深圳市朗科科技股份有限公司 號朗科大廈 層
Publication of HK1164481A1 publication Critical patent/HK1164481A1/en
Publication of HK1164481B publication Critical patent/HK1164481B/en

Links

Landscapes

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

Abstract

The invention discloses a method for storing data into a storage device, wherein writing operation unit of the storage device is a storage page. The method comprises the following steps of: partitioning the data into N data packets and storing the N data packets into the storage device sequentially, wherein the size of the mth data packet of the N data packets is set to make a start storage address of the (m+1)th data packet correspond to a start storage position of a certain storage page; and setting the number of sectors comprised in the (m+1)th data packet to be equal to an integral multiple of the number of sectors comprised in one of the storage pages, wherein m is more than or equal to 1 and less than N. The invention also discloses a system for performing the method and controlling data storage of the storage device.

Description

Data storage method and system
Technical Field
The present invention relates to the field of data processing, and in particular, to a method and system for data storage.
Background
At present, storage devices using flash memories as storage media are increasingly widely used, and how to further improve the read-write speed becomes a focus of attention. As is well known, a flash memory physically has an organization of blocks, pages, and sectors, wherein one physical block is composed of a plurality of physical pages, and one physical page is composed of a plurality of sectors. In flash memory, a memory page is usually used as a write operation unit, i.e., the memory page is the smallest unit of data write. One memory page corresponds to one flash physical page. When writing operation is carried out on the flash memory storage device, if the initial writing address of data is just positioned at the beginning of a certain storage page and the size of the written data is integral multiple of the size of the storage page, the data is written in the whole page, the writing speed is high, and the system overhead is small.
However, in writing data to the flash memory, there may also be a partial page write. That is, data is often written not from the beginning of a page of a memory page, but from the middle of a page. Taking the case shown in fig. 1 as an example, it is assumed that each page is composed of 4 sectors, black indicates a portion to which data has been written, and gray indicates a portion to which data is newly written. As can be seen from the figure, since the first two sectors of page 1 store the previously written data, when storing data in the flash memory this time, the data is written not from the beginning of page 1 but from the 3 rd sector of the page, and ends in the 1 st sector of page 4. In this case, since the page is the smallest writing unit, in order to avoid that the data that needs to be preserved in the first two sectors of the page 1 is covered together when the data is written, the original data stored in the page needs to be transferred to the page buffer first, then the new data to be written is written into the corresponding position of the page buffer, and then the whole page of buffer data containing the original data to be preserved and the new data is written into the page. This process is time consuming and can increase system overhead, thereby degrading storage performance. Likewise, the above-described problems may exist for any memory device having characteristics similar to those described above.
Disclosure of Invention
It is an object of the present invention to provide a method that at least partially solves the above mentioned problems of the prior art.
It is a further object of the present invention to provide a system that at least partially solves the above mentioned problems of the prior art.
In order to achieve the above object, the present invention provides a method of storing data into a memory device, a write operation unit of the memory device being a memory page, the method comprising: dividing the data into N data packets, and sequentially storing the N data packets in the storage device, wherein the size of the mth data packet in the N data packets is set to make the starting storage address of the subsequent (m + 1) th data packet correspond to the starting storage position of a certain storage page, and the number of sectors contained in the (m + 1) th data packet is set to be equal to the integral multiple of the number of sectors contained in one storage page, wherein m is more than or equal to 1 and less than N;
detecting the number of blank sectors which are not occupied by the (m-1) th data packet in a storage page corresponding to the initial storage address of the (m) th data packet; and
and setting the size of the mth data packet to be equal to the sum of the blank sector number and the sector number contained in n storage pages, wherein n is 0, 1, 2, 3.
The present invention also provides a system for controlling data storage in a storage device, where a write operation unit of the storage device is a storage page, the system comprising: a processing module configured to divide the data into N data packets and store the N data packets in the storage device sequentially, wherein the processing module sets a size of an mth data packet of the N data packets such that a starting storage address of a following mth +1 data packet corresponds to a starting storage location of a certain storage page, and sets a number of sectors included in the mth +1 data packet to be equal to an integer multiple of a number of sectors included in one of the storage pages, where 1 ≦ m < N;
the processing module comprises a detection module, the detection module is configured to detect the number of blank sectors which are not occupied by the (m-1) th data packet in a storage page corresponding to the starting storage address of the mth data packet, and the processing module sets the size of the mth data packet to be equal to the sum of the number of blank sectors and the number of sectors contained in n storage pages according to the detection result of the detection module, wherein n is 0, 1, 2, 3.
Drawings
FIG. 1 is a schematic illustration of partial page writes when writing data to a memory device;
FIG. 2 is a schematic diagram of writing data into a storage page in a conventional data packetization mode;
FIG. 3 is a diagram illustrating the writing of data to a memory page using an exemplary data packetization method in accordance with the present invention;
FIG. 4 is a schematic illustration of writing data to a memory page using another exemplary data packetization method of the present invention; and
FIG. 5 is a flow chart of a method of writing data to a memory device, according to an example embodiment of the invention.
Detailed Description
The present invention will be described below by taking a flash memory storage medium as an example, but it will be understood by those skilled in the art that the following description is only exemplary, and the present invention is applicable to a storage device having similar storage characteristics to a flash memory, i.e., a storage device that requires reduced partial page writes to improve storage performance with a page as the smallest write operation unit.
When the host side writes data into the storage device, if the total amount of data to be written is large, the host usually does not send and write all the data into the storage device in a write command, but divides the write command into multiple times and sends part of the data into each write command to write into the storage device. The data transmitted in the write-once command is referred to herein as one packet. In other words, when a file to be written into the storage device is large, the host divides the file data into a plurality of packets (for example, packetizing the data in units of 64K, 128K, or other sizes), writes the content of one packet into the storage device in a write command, and writes all the file data into the storage device in a write command for a plurality of times. For example, for a file with 200k of data size, the host may divide 200k of data into 3 packets of 64k and 1 packet of 8k, and then send the 4 packets to the storage device by 4 write commands to sequentially write data.
However, as described above, when data is written to the storage device, there is a possibility that partial page writing may occur. That is, data is written not from the first sector of a page but from a middle sector of the page. Fig. 2 is a schematic diagram illustrating writing data into a storage page when a conventional data packetization method is used. In the process of writing data, the host computer firstly obtains a start address to be written and the total number of sectors occupied by the data to be written, and then sequentially packetizes the data to be written according to a fixed size. Assuming that the size of a storage page is 8 sectors per page, the start address to be written is the 8 th sector of page 1, the data to be written occupies 72 sectors in total, and the host divides the data into 3 packets according to a data division manner that each packet includes 24 sectors. As shown in fig. 2, after packetizing is completed, the host will sequentially send and write the 1 st to 3 rd packet data to the storage device in the following manner: writing 24 sectors of data of the 1 st packet starting from the 8 th sector and ending at the 31 st sector (the 7 th sector of page 4); writing 24 sectors of data of the 2 nd packet from the 32 nd sector and ending at the 55 th sector (the 7 th sector of page 7); the 24 sectors of the 3 rd packet are written starting from the 56 th sector and ending in the 79 th sector (the 7 th sector of page 10). As can be seen from the above, when writing data of each packet, there are two partial page writes, and during the entire data writing process, 3 × 2 to 6 partial page writes are required. It is conceivable that if the file to be written into the storage device is large, and the number N of the data packets after the packetization processing is a large value, the number N × 2 of partial page writing in the data writing process is considerable, and the storage performance is significantly affected.
In order to solve the problems, the invention improves the prior art, and effectively reduces the situation of partial page writing by adjusting the subpackage strategy when the data is subjected to subpackage processing. According to one embodiment of the invention, when data is divided into N data packets, the size of the mth data packet in the N data packets is set to enable the starting storage address of the (m + 1) th data packet after the mth data packet to correspond to the starting storage position of a certain storage page, wherein m is greater than or equal to 1 and less than N. For example, the data size of the first packet may be adjusted such that the write operation of the first packet ends at the last sector of a certain memory page, and thus the data of the second packet will be written from the beginning of the next page, when m is 1.
According to another embodiment of the present invention, when the data is divided into N packets, the step of setting the size of the mth packet includes: detecting the number of blank sectors which are not occupied by the (m-1) th data packet in a storage page corresponding to the initial storage address of the (m) th data packet; and setting the size of the mth data packet to be equal to the sum of the number of blank sectors and the number of sectors contained in n storage pages (wherein n is 0, 1, 2, 3, ….), so that the starting storage address of the (m + 1) th data packet corresponds to the starting storage position of a certain storage page.
In addition, the number of sectors included in the (m + 1) th data packet may be further set to be equal to an integer multiple of the number of sectors included in one of the storage pages, so that the data of the (m + 2) th data packet is also written from the beginning of a certain storage page.
In order to write the subsequent data packets in the whole page as much as possible, the sizes of the (m + 1) th data packet to the (N-1) th data packet (assuming that all data are divided into N data packets) may be set to be equal to an integral multiple of the number of sectors included in one memory page. Thus, in the case where the data amount of the mth packet is adjusted such that the writing operation of the mth packet ends at the last sector of a certain memory page, the subsequent (m + 1) th to (N-1) th packets will all be written in full pages.
Fig. 3 shows a specific embodiment of the present invention, which is further explained below with reference to the example in fig. 3. The host first knows that the size of the storage page is 8 sectors per page, the start address to be written is the 8 th sector of page 1, and the data to be written needs to occupy 72 sectors in total. According to the method of the invention, the host divides the data into 4 data packets, wherein the 1 st data packet contains 1 sector of data, the 2 nd and 3 rd data packets respectively contain 24 sectors (3 whole pages) of data, and the 4 th data packet contains 23 sectors of data. Thus, when writing data to the storage device, the host will sequentially send and write the 1 st to 4 th packet data to the storage device in the following manner: writing 1 sector data of the 1 st packet in the 8 th sector; writing 24 sectors of data of packet 2 starting from the 9 th sector (1 st sector of page 2) and ending at the 32 th sector (8 th sector of page 4); writing 24 sectors of data of packet 3 starting from the 33 th sector (1 st sector of page 5) and ending at the 56 th sector (8 th sector of page 7); the 23 sectors of the 4 th packet are written starting from the 57 th sector (1 st sector of page 8) and ending at the 79 th sector (7 th sector of page 10). As can be seen from the above process, in the process of writing all data, only the first and last data packets have partial page writing, and all other data packets are full page writing. Compared with the subpackage mode in the prior art, the method can effectively reduce the condition of partial page writing after data is subpackaged, and improve the read-write performance of the storage device.
It will be understood by those skilled in the art that the 1 st data packet may also include 1+ x y sectors of data (where x is the number of sectors included in each memory page and y is a natural number), so that the writing operation of the 1 st data packet ends at the last sector of a certain memory page.
Fig. 4 shows another embodiment of the present invention, which is different from the embodiment shown in fig. 3 in that the host adjusts the amount of data contained in the middle packet, not the first packet, when packetizing the data. As shown in fig. 4, the host divides the data into 4 data packets, wherein the 1 st data packet is divided into 24 sectors of data, the 2 nd data packet comprises 9 sectors of data (1 sector +1 full page), the 3 rd data packet comprises 24 sectors of data (3 full pages), and the 4 th data packet comprises 15 sectors of data. When writing data to the storage device, since the write operation for the 2 nd packet ends in the last sector of page 5, the subsequent packet (i.e., the 3 rd packet) can be written in a full page. That is, when the method of the present invention is applied, the size of the data amount of the first data packet is not limited to be adjusted, but the size of any data packet in the 1 st to N-1 st data packets can be adjusted, so that the data amount contained in the adjusted data packet just occupies the sector where all the written storage pages are not occupied. Thus, the next packet can be written in full pages.
FIG. 5 shows a flow diagram of a method for writing data to a memory device, according to one embodiment of the invention. As shown in the figure, firstly, the type of the storage device is checked, whether the storage device uses a flash memory as a storage medium is judged (step S102), if not, the process is ended, and if so, page size information of the storage device, that is, how many sectors are included in each storage page in the storage device, is further acquired (step S103). Then, a start memory address at which data is to be stored, i.e., from which position in the memory device the data is to be written, is acquired (step S104). Subsequently, the data is divided into N data packets according to the page size information acquired in step S103 and the start target address acquired in step S104, and when the data packet division is performed, the size of each data packet is adjusted so that the last sector in the mth data packet is aligned with the last sector in a certain memory page, that is, the data amount contained in the mth data packet just fills up the sectors not occupied by the (m-1) th data packet in the memory page where writing is started and the N memory pages thereafter, so that the start address of the next data packet just starts from the start sector of the next memory page (step S105), and the number of sectors contained in the (m + 1) th to (N-1) th data packets is respectively equal to the integral multiple of the number of sectors contained in each memory page (step S106). Then, the N packets are sequentially transmitted to and written in the storage device (step S107).
According to the method, the writing of the partial data packets is performed in a whole page by adjusting the data packetization mode, so that the reading and writing performance of the storage device is improved.
It will be understood by those skilled in the art that the specific number of sectors included in each page, the specific amount of data in each packet when packetizing the data, etc. in this specification are exemplary data given for purposes of illustration, and that those skilled in the art may employ different data depending on the specific application based on the principles of the present invention. In addition, various features described in different examples/implementations may be interchanged or combined without departing from the spirit of the invention.
The present application has been described above by way of embodiments and drawings, but the present application is not limited to the above embodiments and drawings, and it will be understood by those skilled in the art that various modifications and equivalent changes may be made without departing from the technical idea of the present application, and these modifications and changes are also included in the scope of protection defined by the claims of the present application.

Claims (6)

1. A method of storing data into a memory device, a write operation unit of the memory device being a memory page, the method comprising:
dividing the data into N data packets and sequentially storing the N data packets in the storage device,
wherein the size of the mth data packet in the N data packets is set to make the starting storage address of the (m + 1) th data packet after the mth data packet correspond to the starting storage position of a certain storage page, and the number of sectors contained in the (m + 1) th data packet is set to be equal to the integral multiple of the number of sectors contained in one storage page, wherein m is more than or equal to 1 and less than N;
detecting the number of blank sectors which are not occupied by the (m-1) th data packet in a storage page corresponding to the initial storage address of the (m) th data packet; and
and setting the size of the mth data packet to be equal to the sum of the blank sector number and the sector number contained in n storage pages, wherein n is 0, 1, 2, 3.
2. The method of claim 1, wherein the step of dividing the data to be stored into N data packets further comprises setting the number of sectors included in each of the (m + 1) th to (N-1) th data packets equal to an integer multiple of the number of sectors included in one of the storage pages.
3. The method of claim 1, wherein prior to the step of packet segmentation, further comprising:
judging whether the storage device comprises a flash memory storage medium or not;
if yes, inquiring the number of sectors contained in one storage page.
4. A system for controlling storage of data in a storage device, a write operation unit of the storage device being a storage page, the system comprising:
a processing module configured to divide the data into N data packets and store the N data packets in the storage device sequentially, wherein the processing module sets a size of an mth data packet of the N data packets such that a starting storage address of a following mth +1 data packet corresponds to a starting storage location of a certain storage page, and sets a number of sectors included in the mth +1 data packet to be equal to an integer multiple of a number of sectors included in one of the storage pages, where 1 ≦ m < N;
the processing module comprises a detection module, the detection module is configured to detect the number of blank sectors which are not occupied by the (m-1) th data packet in a storage page corresponding to the starting storage address of the mth data packet, and the processing module sets the size of the mth data packet to be equal to the sum of the number of blank sectors and the number of sectors contained in n storage pages according to the detection result of the detection module, wherein n is 0, 1, 2, 3.
5. The system of claim 4, wherein the processing module is configured to set the number of sectors included in each of the (m + 1) th to (N-1) th data packets to be equal to an integer multiple of the number of sectors included in one of the memory pages.
6. The system of claim 4, further comprising:
and the judging module is configured to judge whether the storage device comprises a flash storage medium, if so, inquire the sector number contained in one storage page and send the inquiry result to the processing module.
HK12104708.1A 2012-05-14 Method and system for data storage HK1164481B (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201010178238.5A CN102243611B (en) 2010-05-11 2010-05-11 Data storage method and system

Publications (2)

Publication Number Publication Date
HK1164481A1 true HK1164481A1 (en) 2012-09-21
HK1164481B HK1164481B (en) 2016-03-24

Family

ID=

Also Published As

Publication number Publication date
CN102243611A (en) 2011-11-16
CN102243611B (en) 2015-06-17

Similar Documents

Publication Publication Date Title
US8010770B2 (en) Caching device for NAND flash translation layer
US8417901B2 (en) Combining write commands to overlapping addresses or to a specific page
US7594087B2 (en) System and method for writing data to and erasing data from non-volatile memory
US8397017B2 (en) Controller and data storage device
US8650379B2 (en) Data processing method for nonvolatile memory system
US20090172264A1 (en) System and method of integrating data accessing commands
US20120290769A1 (en) Flash memory device, memory control device, memory control method, and storage system
US20100161887A1 (en) Storage device, control method thereof, and electronic device using storage device
US20100318760A1 (en) Memory controller, nonvolatile storage device, and nonvolatile storage system
KR101431205B1 (en) Cache memory device and data processing method of the device
US20090228662A1 (en) Multi-channel memory storage device and control method thereof
CN103761988A (en) SSD (solid state disk) and data movement method
US20170220462A1 (en) Data storage method and system thereof
US9519541B2 (en) Data storage device and data checking and correction for volatile memory
CN103077094A (en) Storage control apparatus, storage apparatus, information processing system, and storage control method
US11941273B2 (en) Variable capacity Zone Namespace (ZNS) flash storage data path
KR20170010810A (en) Method, device and user equipment for reading/writing data in nand flash
CN108132760B (en) Method and system for improving SSD (solid State disk) reading performance
US7836243B2 (en) Nonvolatile semiconductor memory apparatus and memory system
US7598891B2 (en) Data development device and data development method
US20090049233A1 (en) Flash Memory, and Method for Operating a Flash Memory
CN111026678B (en) Cache design method and device based on solid state disk and computer equipment
US8423819B2 (en) Data storage device, controller, and data access method for a downgrade memory
US20100262763A1 (en) Data access method employed in multi-channel flash memory system and data access apparatus thereof
HK1164481A1 (en) Method and system for data storage