CN105260135A - Storage space read-write control method and system - Google Patents
Storage space read-write control method and system Download PDFInfo
- Publication number
- CN105260135A CN105260135A CN201510610020.5A CN201510610020A CN105260135A CN 105260135 A CN105260135 A CN 105260135A CN 201510610020 A CN201510610020 A CN 201510610020A CN 105260135 A CN105260135 A CN 105260135A
- Authority
- CN
- China
- Prior art keywords
- storage block
- storage
- counter
- numbering
- storage space
- 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
Links
Abstract
The invention discloses a storage space read-write control method and system. The method comprises the following steps: previously dividing a storage space into a plurality of storage blocks which are the same in the aspect of size, sequentially numbering from small to big according to the addresses of the storage blocks, and correlating the addresses of the storage blocks to the numbers; setting a counter for the storage block in each number, wherein the counters are used for counting the write frequencies of the storage blocks; when executing a write operation on one storage block, obtaining the number of the storage block and adding 1 to the counter corresponding to the number; and periodically detecting the counter of each storage block, and when the counting value of a counter exceeds a preset threshold value, moving the file stored in the storage block in the corresponding number into the vacant storage blocks, the counting values of which do not exceed the preset value. According to the storage space read-write control method and system, when the counting value of the counter of a certain storage block exceeds the preset threshold value, the file stored in the storage block in the corresponding number can be moved to the vacant storage blocks, the counting values of which do not exceed the preset value, so that the files are prevented from being lost and damaged.
Description
Technical field
The present invention relates to technical field of data storage, particularly relate to a kind of storage space read/writing control method and system.
Background technology
Along with the development of mobile communication and improving constantly of people's living standard, the use of various mobile terminals as mobile phone is more and more universal, and mobile phone has become indispensable means of communication in people's life.
In prior art, the function of mobile phone gets more and more, and memory function is one of function of often using of mobile terminal.
At present, the storage chip of mobile terminal is made up of storage unit one by one, and each storage unit has the restriction of reading and writing number of times, and the number of times restriction of generally speaking reading is far away higher than the number of times restriction write, in user uses, generally all can not reach the restriction of reading number of times, this programme is not done to be concerned about.
Because heap file (comprising photo, the installation file of software, the file of operating system) can be kept in storage chip by mobile terminal often; and these files do not take fixing storage unit for a long time; this concentrates in some fixing storage unit with regard to making the daily operation writing storage chip; the limited number of times easily causing some storage unit to be write is exceeded; storage unit is caused to use, thus the file corruption causing user to preserve.
Therefore, prior art has yet to be improved and developed.
Summary of the invention
The technical problem to be solved in the present invention is, for the above-mentioned defect of prior art, provides a kind of storage space read/writing control method and system.Provide a kind of storage space read/writing control method and system of fast and reliable, being intended to solve the existing operation writing storage chip concentrates in some fixing storage unit, the limited number of times easily causing some storage unit to be write is exceeded, storage unit is caused to use, thus the problem of the file corruption causing user to preserve.
The technical scheme that technical solution problem of the present invention adopts is as follows:
A kind of storage space read/writing control method, wherein, comprising:
A, storage space is divided into equal-sized multiple storage block in advance, by the ascending number consecutively in the address of storage block, and the address of described storage block is associated with described numbering; Simultaneously for the storage block of each numbering arranges a counter, described counter is used for counting the number of times write of storage block;
B, when performing a write operation to a storage block, obtain storage block numbering and the counter of this numbering correspondence is added 1;
The counter of each storage block of C, periodic detection, when the count value of counter exceedes predetermined threshold, moves to the file stored in corresponding numbering storage block in the storage block of the free time of the not super predetermined value of count value.
Described storage space read/writing control method, wherein, comprised before described steps A:
S, pre-set the predetermined threshold each storage block being write to number of times.
Described storage space read/writing control method, wherein, the size of described storage block is 10 megabyte.
Described storage space read/writing control method, wherein, described step B comprises:
B1. when the write operation instruction to storage space being detected, according to the address of write storage space, the numbering of the storage block be associated with described address is obtained;
B2. obtain the numbering of storage block and the counter of this numbering correspondence is added 1.
Described storage space read/writing control method, wherein, described step C comprises:
C1. start timer, trigger execution step C2 by described timer every the set time
C2. the counter of each storage block of periodic detection, when the count value of counter exceedes predetermined threshold, moves to the file stored in corresponding numbering storage block in the storage block of the free time of the not super predetermined value of count value.
Described storage space read/writing control method, wherein, the described set time is 100 hours; Described predetermined threshold is 1000 times.
A kind of storage space read-write control system, wherein, comprising:
Storage block divides module, for storage space being divided into equal-sized multiple storage block in advance, by the ascending number consecutively in the address of storage block, and is associated with described numbering the address of described storage block; Simultaneously for the storage block of each numbering arranges a counter, described counter is used for counting the number of times write of storage block;
Detection module, for when performing a write operation to a storage block, obtaining the numbering of storage block and the counter of this numbering correspondence is added 1;
Periodic detection and file shift module, for the counter of each storage block of periodic detection, when the count value of counter exceedes predetermined threshold, move in the storage block of the free time of the not super predetermined value of count value by the file stored in corresponding numbering storage block;
Pre-set module, for pre-setting the predetermined threshold each storage block being write to number of times.
Described storage space read-write control system, wherein, described detection module comprises:
Detecting unit, for when the write operation instruction to storage space being detected, according to the address of write storage space, obtains the numbering of the storage block be associated with described address;
Acquiring unit, for obtaining the numbering of storage block and the counter of this numbering correspondence being added 1.
Described storage space read-write control system, wherein, described step periodic detection and file shift module comprise:
Start unit, for starting timer, is triggered every the set time by described timer;
Periodic detection unit, for the counter of each storage block of periodic detection;
File branch control unit, for when the count value of counter exceedes predetermined threshold, moves to the file stored in corresponding numbering storage block in the storage block of the free time of the not super predetermined value of count value.
Described storage space read-write control system, wherein, the size of described storage block is 10 megabyte; The described set time is 100 hours; Described predetermined threshold is 1000 times.
Storage space read/writing control method provided by the present invention and system, by storage space being divided into equal-sized multiple storage block in advance, by the ascending number consecutively in the address of storage block, and be associated the address of described storage block with described numbering; Simultaneously for the storage block of each numbering arranges a counter, described counter is used for counting the number of times write of storage block; When performing a write operation to a storage block, obtaining the numbering of storage block and the counter of this numbering correspondence is added 1; The counter of each storage block of periodic detection, when the count value of counter exceedes predetermined threshold, moves to the file stored in corresponding numbering storage block in the storage block of the free time of the not super predetermined value of count value.The present invention can realize when the count value of certain storage block counter exceedes predetermined threshold, is moved to by the file stored in the storage block of the free time of the not super predetermined value of count value, avoid File lose to damage in corresponding numbering storage block; Provide users with the convenient.
Accompanying drawing explanation
Fig. 1 is the process flow diagram of the preferred embodiment of a kind of storage space read/writing control method of the present invention.
Fig. 2 is the particular flow sheet of the step S200 of the preferred embodiment of a kind of storage space read/writing control method of the present invention.
Fig. 3 is the particular flow sheet of the step S300 of the preferred embodiment of a kind of storage space read/writing control method of the present invention.
Fig. 4 is the process flow diagram of the preferred embodiment of a kind of storage space read-write control system of the present invention.
Embodiment
For making object of the present invention, technical scheme and advantage clearly, clearly, developing simultaneously referring to accompanying drawing, the present invention is described in more detail for embodiment.Should be appreciated that specific embodiment described herein only in order to explain the present invention, be not intended to limit the present invention.
Refer to Fig. 1, Fig. 1 is the process flow diagram of the preferred embodiment of a kind of storage space read/writing control method of the present invention.A kind of storage space read/writing control method shown in Fig. 1, comprises the following steps:
Step S100, storage space is divided into equal-sized multiple storage block in advance, by the ascending number consecutively in the address of storage block, and the address of described storage block is associated with described numbering; Simultaneously for the storage block of each numbering arranges a counter, described counter is used for counting the number of times write of storage block.
Need in the embodiment of the present invention storage space to be divided into equal-sized multiple storage block in advance.Particularly, the size of described storage block is 10 megabyte; For example, storage size is 500 megabyte, by the ascending number consecutively in the address of storage block: in storage space the 1 to 10 megabyte be numbered 1 storage block, in storage space the 11 to 20 megabyte be numbered 2 storage block, in storage space the 21 to 30 megabyte be numbered 3 storage block,, in storage space the 491 to 500 megabyte be numbered 50 storage block.
Step S200, when performing a write operation to a storage block, obtain storage block numbering and the counter of this numbering correspondence is added 1.
Particularly, refer to Fig. 2, Fig. 2 is the particular flow sheet of step S200, and described step S200 comprises:
S201. when the write operation instruction to storage space being detected, according to the address of write storage space, the numbering of the storage block be associated with described address is obtained;
For example, when the write operation instruction to storage space being detected, the address obtaining this write operation is positioned at the 21 to 30 megabyte, then storage block be numbered 3;
S202. obtain the numbering of storage block and the counter of this numbering correspondence is added 1.
The counter of each storage block of step S300, periodic detection, when the count value of counter exceedes predetermined threshold, moves to the file stored in corresponding numbering storage block in the storage block of the free time of the not super predetermined value of count value.
Particularly, refer to Fig. 3, Fig. 3 is the particular flow sheet of step S300, and described step S300 comprises:
S301, starts timer, triggers execution step S302 by described timer every the set time;
Wherein, the described set time is 100 hours.
S302. the counter of each storage block of periodic detection, when the count value of counter exceedes predetermined threshold, moves to the file stored in corresponding numbering storage block in the storage block of the free time of the not super predetermined value of count value.
Namely in the embodiment of the present invention, by work as the storage number of times certain storage block being detected exceed predetermined threshold time, the file stored in corresponding numbering storage block can be moved in the storage block of the free time of the not super predetermined value of count value.
In the embodiment of the present invention, in the specific implementation, need to pre-set the predetermined threshold each storage block being write to number of times; Such as, described threshold value is 1000 times.
For example, detect that the counter of the storage block being numbered 2 is more than 1000, then the file stored in numbering 2 is moved in idle storage block; The file namely will stored in the storage block being numbered 2, copies in idle storage block, and the storage block being numbered 2 is emptied.
Provide a kind of storage space read/writing control method and system of fast and reliable, being intended to solve the existing operation writing storage chip concentrates in some fixing storage unit, the limited number of times easily causing some storage unit to be write is exceeded, storage unit is caused to use, thus the problem of the file corruption causing user to preserve.
Based on above-described embodiment, present invention also offers a kind of storage space read-write control system, as shown in Figure 4, described system comprises:
Storage block divides module 410, for storage space being divided into equal-sized multiple storage block in advance, by the ascending number consecutively in the address of storage block, and is associated with described numbering the address of described storage block; Simultaneously for the storage block of each numbering arranges a counter, described counter is used for counting the number of times write of storage block; As detailed above.
Detection module 420, for when performing a write operation to a storage block, obtaining the numbering of storage block and the counter of this numbering correspondence is added 1; As detailed above.
Periodic detection and file shift module 430, for the counter of each storage block of periodic detection, when the count value of counter exceedes predetermined threshold, move in the storage block of the free time of the not super predetermined value of count value by the file stored in corresponding numbering storage block; As detailed above.
Pre-set module 440, for pre-setting the predetermined threshold each storage block being write to number of times; As detailed above.
Further, described storage space read-write control system, wherein, described detection module comprises:
Detecting unit, for when the write operation instruction to storage space being detected, according to the address of write storage space, obtains the numbering of the storage block be associated with described address; As detailed above.
Acquiring unit, for obtaining the numbering of storage block and the counter of this numbering correspondence being added 1; As detailed above.
Described storage space read-write control system, wherein, described step periodic detection and file shift module comprise:
Start unit, for starting timer, is triggered every the set time by described timer; As detailed above.
Periodic detection unit, for the counter of each storage block of periodic detection; As detailed above.
File branch control unit, for when the count value of counter exceedes predetermined threshold, moves in the storage block of the free time of the not super predetermined value of count value by the file stored in corresponding numbering storage block; As detailed above.
Described storage space read-write control system, wherein,
The size of described storage block is 10 megabyte;
The described set time is 100 hours; Described predetermined threshold is 1000 times; As detailed above.
In sum, storage space read/writing control method provided by the present invention and system, by storage space being divided into equal-sized multiple storage block in advance, by the ascending number consecutively in the address of storage block, and the address of described storage block is associated with described numbering; Simultaneously for the storage block of each numbering arranges a counter, described counter is used for counting the number of times write of storage block; When performing a write operation to a storage block, obtaining the numbering of storage block and the counter of this numbering correspondence is added 1; The counter of each storage block of periodic detection, when the count value of counter exceedes predetermined threshold, moves in the storage block of the free time of the not super predetermined value of count value by the file stored in corresponding numbering storage block; The present invention can realize when the count value of certain storage block counter exceedes predetermined threshold, is moved to by the file stored in the storage block of the free time of the not super predetermined value of count value, avoid File lose to damage in corresponding numbering storage block; Provide users with the convenient.
Should be understood that, application of the present invention is not limited to above-mentioned citing, for those of ordinary skills, can be improved according to the above description or convert, and all these improve and convert the protection domain that all should belong to claims of the present invention.
Claims (10)
1. a storage space read/writing control method, is characterized in that, comprising:
A, storage space is divided into equal-sized multiple storage block in advance, by the ascending number consecutively in the address of storage block, and the address of described storage block is associated with described numbering; Simultaneously for the storage block of each numbering arranges a counter, described counter is used for counting the number of times write of storage block;
B, when performing a write operation to a storage block, obtain storage block numbering and the counter of this numbering correspondence is added 1;
The counter of each storage block of C, periodic detection, when the count value of counter exceedes predetermined threshold, moves to the file stored in corresponding numbering storage block in the storage block of the free time of the not super predetermined value of count value.
2. storage space read/writing control method according to claim 1, is characterized in that, comprises before described steps A:
S, pre-set the predetermined threshold each storage block being write to number of times.
3. storage space read/writing control method according to claim 1, is characterized in that, the size of described storage block is 10 megabyte.
4. storage space read/writing control method according to claim 1, is characterized in that,
Described step B comprises:
B1. when the write operation instruction to storage space being detected, according to the address of write storage space, the numbering of the storage block be associated with described address is obtained;
B2. obtain the numbering of storage block and the counter of this numbering correspondence is added 1.
5. storage space read/writing control method according to claim 1, is characterized in that, described step C comprises:
C1. start timer, trigger execution step C2 by described timer every the set time
C2. the counter of each storage block of periodic detection, when the count value of counter exceedes predetermined threshold, moves to the file stored in corresponding numbering storage block in the storage block of the free time of the not super predetermined value of count value.
6. storage space read/writing control method according to claim 5, is characterized in that, the described set time is 100 hours; Described predetermined threshold is 1000 times.
7. a storage space read-write control system, is characterized in that, comprising:
Storage block divides module, for storage space being divided into equal-sized multiple storage block in advance, by the ascending number consecutively in the address of storage block, and is associated with described numbering the address of described storage block; Simultaneously for the storage block of each numbering arranges a counter, described counter is used for counting the number of times write of storage block;
Detection module, for when performing a write operation to a storage block, obtaining the numbering of storage block and the counter of this numbering correspondence is added 1;
Periodic detection and file shift module, for the counter of each storage block of periodic detection, when the count value of counter exceedes predetermined threshold, move in the storage block of the free time of the not super predetermined value of count value by the file stored in corresponding numbering storage block;
Pre-set module, for pre-setting the predetermined threshold each storage block being write to number of times.
8. storage space read-write control system according to claim 7, is characterized in that, described detection module comprises:
Detecting unit, for when the write operation instruction to storage space being detected, according to the address of write storage space, obtains the numbering of the storage block be associated with described address;
Acquiring unit, for obtaining the numbering of storage block and the counter of this numbering correspondence being added 1.
9. storage space read-write control system according to claim 7, is characterized in that, described periodic detection and file shift module comprise:
Start unit, for starting timer, is triggered every the set time by described timer;
Periodic detection unit, for the counter of each storage block of periodic detection;
File branch control unit, for when the count value of counter exceedes predetermined threshold, moves to the file stored in corresponding numbering storage block in the storage block of the free time of the not super predetermined value of count value.
10. storage space read-write control system according to claim 9, is characterized in that,
The size of described storage block is 10 megabyte;
The described set time is 100 hours; Described predetermined threshold is 1000 times.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510610020.5A CN105260135A (en) | 2015-09-23 | 2015-09-23 | Storage space read-write control method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510610020.5A CN105260135A (en) | 2015-09-23 | 2015-09-23 | Storage space read-write control method and system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN105260135A true CN105260135A (en) | 2016-01-20 |
Family
ID=55099842
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510610020.5A Pending CN105260135A (en) | 2015-09-23 | 2015-09-23 | Storage space read-write control method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105260135A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107039076A (en) * | 2017-03-20 | 2017-08-11 | 北京握奇智能科技有限公司 | A kind of method and apparatus for extending the erasable chip life-span |
CN112256194A (en) * | 2020-09-30 | 2021-01-22 | 新华三技术有限公司成都分公司 | Storage space distribution method and storage server |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101226504A (en) * | 2008-01-25 | 2008-07-23 | 炬力集成电路设计有限公司 | Method and apparatus for preventing memory from damage |
CN102081576A (en) * | 2011-03-01 | 2011-06-01 | 华中科技大学 | Flash memory wear balance method |
CN102222046A (en) * | 2011-06-09 | 2011-10-19 | 清华大学 | Abrasion equilibrium method and device |
US20120317345A1 (en) * | 2011-06-09 | 2012-12-13 | Tsinghua University | Wear leveling method and apparatus |
CN102880556A (en) * | 2012-09-12 | 2013-01-16 | 浙江大学 | Wear leveling method and system of Nand Flash |
-
2015
- 2015-09-23 CN CN201510610020.5A patent/CN105260135A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101226504A (en) * | 2008-01-25 | 2008-07-23 | 炬力集成电路设计有限公司 | Method and apparatus for preventing memory from damage |
CN102081576A (en) * | 2011-03-01 | 2011-06-01 | 华中科技大学 | Flash memory wear balance method |
CN102222046A (en) * | 2011-06-09 | 2011-10-19 | 清华大学 | Abrasion equilibrium method and device |
US20120317345A1 (en) * | 2011-06-09 | 2012-12-13 | Tsinghua University | Wear leveling method and apparatus |
CN102880556A (en) * | 2012-09-12 | 2013-01-16 | 浙江大学 | Wear leveling method and system of Nand Flash |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107039076A (en) * | 2017-03-20 | 2017-08-11 | 北京握奇智能科技有限公司 | A kind of method and apparatus for extending the erasable chip life-span |
CN112256194A (en) * | 2020-09-30 | 2021-01-22 | 新华三技术有限公司成都分公司 | Storage space distribution method and storage server |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11023372B2 (en) | Application memory reclaim method and apparatus | |
CN105159777B (en) | The method for recovering internal storage and device of process | |
CN103092700B (en) | Internal memory method for cleaning, device and terminal unit | |
CN105868122A (en) | Data processing method and device for quick flashing storage equipment | |
CN103246638A (en) | Information pasting method and device | |
TWI628588B (en) | System, method and terminal for cleaning memory | |
CN103530186A (en) | Method and system for achieving multi-position storage supported by camera application | |
EP3059679A1 (en) | Controller, flash memory device, method for identifying data block stability and method for storing data on flash memory device | |
CN102866947A (en) | Method for detecting internal memory leakage of Linux kernel | |
CN105045637A (en) | Application start method and terminal | |
CN107590144A (en) | A kind of file memory method and terminal | |
WO2018006721A1 (en) | Method and apparatus for storing log file | |
CN109213448B (en) | Method, device, equipment and storage medium for erasing and writing data of smart card | |
CN105260135A (en) | Storage space read-write control method and system | |
CN105404551A (en) | Processing method and system for switching application between foreground and background of mobile terminal and mobile terminal | |
US8726101B2 (en) | Apparatus and method for tracing memory access information | |
CN107229421B (en) | Method and device for creating video data storage system, method and device for writing file into video data storage system and method and device for reading video data storage system | |
CN105700827A (en) | Android APP migration method and system | |
CN106909374B (en) | Method for realizing alarm clock in shutdown state of intelligent terminal and intelligent terminal | |
CN103617135A (en) | Method and device for reading data in storage equipment | |
CN106202262B (en) | Information processing method and electronic equipment | |
WO2016023276A1 (en) | Data processing method and device for storage card | |
CN105335095A (en) | Flash file system processing method and apparatus | |
CN113051184B (en) | Data reading method and device, electronic equipment and storage medium | |
CN107423165A (en) | A kind of data snapshot head writes copy method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20160120 |