CN105760311B - Trim command response method and system and operating system - Google Patents

Trim command response method and system and operating system Download PDF

Info

Publication number
CN105760311B
CN105760311B CN201610089522.2A CN201610089522A CN105760311B CN 105760311 B CN105760311 B CN 105760311B CN 201610089522 A CN201610089522 A CN 201610089522A CN 105760311 B CN105760311 B CN 105760311B
Authority
CN
China
Prior art keywords
trim
current
order
mapping relations
trim order
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.)
Active
Application number
CN201610089522.2A
Other languages
Chinese (zh)
Other versions
CN105760311A (en
Inventor
邹左衡
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Allwinner Technology Co Ltd
Original Assignee
Allwinner 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 Allwinner Technology Co Ltd filed Critical Allwinner Technology Co Ltd
Priority to CN201610089522.2A priority Critical patent/CN105760311B/en
Publication of CN105760311A publication Critical patent/CN105760311A/en
Application granted granted Critical
Publication of CN105760311B publication Critical patent/CN105760311B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/06Addressing a physical block of locations, e.g. base addressing, module addressing, memory dedication

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

The invention discloses a kind of trim command response method and system and operating systems, and wherein method includes: the current trim order that receiving host issues;Obtain the specified current logical address of current trim order;According to current trim order, after modifying current mapping relations in memory, returning indicates the answer signal of current trim order completion to host;And when host system re-powers after a loss of power, the first trim order that receiving host actively issues, and corresponding first mapping relations are established according to the first trim order in memory.It need to only modify corresponding mapping relations in memory, avoid the modification carried out to the physical address in flash memory, therefore save the processing time modified to the physical address of flash memory.The problem of finally efficiently solving the response mode of traditional trim order influences the command response time, reduces command response efficiency.

Description

Trim command response method and system and operating system
Technical field
The present invention relates to technical field of data storage, more particularly to a kind of trim command response method and system and operation System.
Background technique
Solid state hard disk (Solid State Drives, SSD) abbreviation hard disk is to use solid-state electronic storage chip (such as: NAND Flash memory) array and manufactured hard disk.In general, nand flash memory physically must first carry out erasing operation before data are written.And Before being wiped, then original effective data in the memory block by storage chip is needed to be transferred in the block to have nuzzled up, The process is known as " garbage collection procedure ".And the efficiency of garbage collection procedure directly affects the write performance of flash memory.Removal process effect Rate is higher, and the influence to host to the write performance of flash memory write-in data is smaller.When the data on a block are all invalid data When, the efficiency of recycling is higher.Therefore, in order to improve garbage reclamation efficiency, it is typically employed in ATA (Advanced Technoligy Attachment, Advanced Technology Attachment specification) increase trim order in agreement newly, when deleting file, ordered by this by one Segment data is set as in vain, to improve the efficiency of the subsequent garbage reclamation of flash memory.Meanwhile trim order also reduces invalid data Move, reduce the abrasion of storage chip, improve the service life of flash memory.
Currently, being usually to modify trim order related data for the response of the trim order increased newly in ATA agreement Corresponding list item specifically includes the data mode table of logic-based allocation index and the data mode table based on physical address. At that time, when the corresponding regional scope of trim order is very big, the number of list item modification and time are accordingly longer, this is also just affected To the response time of trim order, response efficiency is reduced.
Summary of the invention
Based on this, it is necessary to influence order sound to the response mode of the trim order increased newly in ATA agreement for traditional Between seasonable, the problem of reducing command response efficiency, provides a kind of trim command response method and system and operating system.
A kind of trim command response method that purpose provides to realize the present invention, includes the following steps:
The current trim order that receiving host issues;
Obtain the specified current logical address of the current trim order;
According to the current trim order, the current logical address and corresponding current physical address are modified in memory Current mapping relations after, returning indicates the answer signal of the current trim order completion to the host;And
When host system re-powers after a loss of power, the first trim order that the host actively issues, and root are received Corresponding first mapping relations are established in the memory according to the first trim order;
Wherein, first mapping relations are that the first specified logical address of the first trim order is its corresponding The mapping relations of first physical address.
It is described according to the current trim order in one of the embodiments, the current logic is modified in memory When address is with the current mapping relations of corresponding current physical address, including setting nothing for the state of the current logical address The step of effect state;And
After returning to the answer signal to the host, the corresponding current physical address of the current logical address State remain unchanged.
It further include that the host passes through when the host system re-powers after a loss of power in one of the embodiments, The application program of operating system, which is collected, generates the required necessary information of the first trim order, and raw according to the necessary information At and the step of issue the corresponding first trim order;
Wherein, the necessary information includes not used space address in file system.
The host is collected by the application program of operating system and generates the first trim in one of the embodiments, Necessary information needed for order, and generated according to the necessary information and issue the corresponding first trim order, including such as Lower step:
Scan the file system;
Count not used space address in the file system;
The not used space address of statistics is packaged into the first trim order;
The first trim order is sent, and abandons the mapping relations of the not used space address.
It is described in one of the embodiments, to rebuild corresponding first in the memory according to the first trim order Mapping relations include the following steps:
According to the first trim order, specified first logical address of the first trim order is obtained;
The corresponding current physical address of first logical address is deleted, first logical address is established and is deleted The relationship between physical address after first physical address.
It further include the storage current mapping relations in one of the embodiments, before host system power-off Step into flash memory.
Correspondingly, the present invention also provides a kind of trim command response system, including trim order issues module, logically Location obtains module, mapping relations modified module and trim command response module;
The trim order issues module, is configured as issuing current trim order;
The logical address obtains module, is configured as receiving the current trim order, and obtain the current trim The specified current logical address of order;
The mapping relations modified module is configured as being worked as described in modification in memory according to the current trim order The current mapping relations of preceding logical address and corresponding current physical address;
The trim command response module is configured as the mapping relations modified module and is ordered according to the current trim It enables, after modifying the current mapping relations in memory, returning indicates the answer signal of the current trim order completion to master Machine;
The trim order issues module, when being additionally configured to host system and re-powering after a loss of power, actively issues One trim order;
The logical address obtains module, is additionally configured to receive the first trim order;
The mapping relations modified module is configured as being rebuild in the memory accordingly according to the first trim order The first mapping relations;
Wherein, first mapping relations are that the first specified logical address of the first trim order is its corresponding The mapping relations of first physical address.
The mapping relations modified module includes logical address modification unit in one of the embodiments,;
The logical address modifies unit, is configured as setting invalid state for the state of the current logical address, And after the trim command response module returns to the answer signal to the host, the corresponding institute of the current logical address The state for stating current physical address remains unchanged.
It includes file system scanning element, space address that the trim order, which issues module, in one of the embodiments, Statistic unit, order encapsulation unit and order issuance unit;
The file system scanning element is configured as scanning file system;
The space address statistic unit is configured as counting not used space address in the file system;
The order encapsulation unit is configured as the not used space address of statistics being packaged into described first Trim order;
The order issuance unit is configured as sending the first trim order, and abandons the not used space The mapping relations of address.
The mapping relations modified module further includes mapping relations modification unit in one of the embodiments,;
The logical address obtains module, is additionally configured to obtain the first trim according to the first trim order The first specified logical address of order;
The mapping relations modify unit, are configured as deleting corresponding first physical address of first logical address, The relationship between physical address after establishing first logical address and deletion first physical address.
It in one of the embodiments, further include storage control module;
The storage control module is configured as storing the current mapping relations into flash memory.
Correspondingly, the present invention also provides a kind of operating system, including host system, flash controller and any institute as above The trim command response system stated;
Wherein, the logical address in the trim command response system obtains module, mapping relations modified module and trim Command response module is loaded in the flash controller;
Trim order in the trim command response system issues module and is loaded in the host system.
Above-mentioned trim command response method the utility model has the advantages that
Its current trim order issued by receiving host, with obtaining the specified current logic of current trim order Location, and current logical address is modified according to current trim order in memory and is closed with the current mapping of corresponding current physical address After system, the answer signal for indicating trim order completion is directly returned to host, thus without again will be according to received each time In the current modified current mapping relations write-in flash memory of trim order, this also just saves the primary current trim life of every reception It enables, just modifies the time of the physical address of a flash memory.Meanwhile when being re-powered after host system power-off, actively by host The first trim order is issued, and then establishes corresponding first mapping in memory further according to the first trim order received and closes System, can be according to the current trim order received in memory to current in order to which host system powers on during finishing operation Mapping relations are modified, to realize the real-time response to trim order.Also, electricity finishes the runtime on the host computer system for it Between and power-off after when re-powering, it is only necessary to modified in memory according to the current trim order received or the first trim order Corresponding mapping relations, whole process does not all need to carry out actual modification to the physical address in flash memory, therefore saves response The processing time modified in trim command procedure to the physical address of flash memory, it is possible thereby to rapidly hold within a short period of time The trim order of the continuous multiple big data sections of row, reduces the waiting time of system, improve the response speed of trim order with Efficiency.Finally efficiently solve it is traditional in ATA agreement increase newly trim order response mode influence the command response time, The problem of reducing command response efficiency.
Detailed description of the invention
Fig. 1 is the flow chart of a specific embodiment of trim command response method of the invention;
Fig. 2 is that host system provides text during operation in a specific embodiment of trim command response method of the invention To the flow chart of current trim command response before part read-write service;
Fig. 3 is to re-power after host system power-off in a specific embodiment of trim command response method of the invention When, host actively issues the flow chart of the first trim order;
Fig. 4 is to re-power after host system power-off in a specific embodiment of trim command response method of the invention When, rebuild the flow chart of the second mapping relations in memory according to the first trim order that host issues;
Fig. 5 is the structural schematic diagram of a specific embodiment of trim command response system of the invention;
Fig. 6 is the structural schematic diagram of the another specific embodiment of trim command response system of the invention.
Specific embodiment
To keep technical solution of the present invention clearer, the present invention is made below in conjunction with drawings and the specific embodiments further detailed It describes in detail bright.
First, it should be noted that trim order is that nand flash memory physically carries out erasing operation before data are written When, it is used to notify those of host equipment flash memory logical address no longer occupied by the file system of operating system, can be led Machine equipment is recovered as the order of free space.One piece of data can be set as in vain by trim order, to improve flash memory The efficiency of garbage reclamation (i.e. erasing operation).
Wherein, the content for the trim order that host issues not is unique constant, but issues trim life according to host The state of flash memory when enabling is changed accordingly.Also, host be not yet a trim order is only issued just to terminate, but The state according to flash memory of not timing carries out issuing for multiple trim order.Therefore, it is host system that the first trim order is corresponding The address state of flash memory when being re-powered after system power-off.Correspondingly, it is that host system is powering on that current trim order is then corresponding After run during, the address state of flash memory when host issues current trim order.
Step S001 ' is being carried out as a specific embodiment of trim command response method of the invention referring to Fig. 1, Before file read-write service is provided, step S100, the current trim order that receiving host issues is first carried out.That is, provide to Data are written in flash memory or before reading data in flash memory, first by step S110, host is according to number is written into flash memory According to or from read the instructions of data in flash memory, current trim order is issued, and then again by step S120, receive current trim and order It enables.Wherein, the address state of flash memory when the content corresponding host of current trim order issues the current command.
And then the specified current logical address of current trim order is obtained by step S200 again.Wherein, due to host In the current trim order issued usually all can include need at this time be written or read data flash memory ranges of logical addresses, Therefore, current trim order can directly acquire the specified current logical address model of current trim order based on the received It encloses.
Then, then execute step S300, according to current trim order, modify in memory current logical address with it is corresponding The current mapping relations of current physical address.Herein it should be noted that according to current trim order, modification is current in memory When logical address is with the current mapping relations of corresponding current physical address, it is specifically related to two list items.One list item is The state of current logical address, another list item are the shape of the current physical address of flash memory corresponding with current logical address State.In trim command response method of the invention, when modifying current mapping relations in memory, referring to fig. 2, specifically include Step S310 modifies the state of current logical address, sets invalid for the state of current logical address.Then step is directly executed Rapid S400, the answer signal that the current trim order of return expression is completed to host.Meanwhile it is corresponding current to current logical address The state of physical address does not change then, that is, the state of the corresponding current physical address of current logical address remains unchanged. It is achieved in the modification to current mapping relations.
After receiving the current trim order that host issues again, further according to current trim order received at this time The current mapping relations of current logical address at this time and current physical address in corresponding modification memory, and return to answer signal extremely Host.
That is, the specific embodiment as trim command response method of the invention, mentions during host system operation During for file read-write service, according to current trim order received every time, work as what current trim order was specified It is the setting carried out in memory when the state of preceding logical address is set as invalid.That is, being repaired every time according to current trim order When changing corresponding current mapping relations, only modified accordingly in memory.And it carries out current mapping in memory to close When the modification of system, the state of current logical address is only modified, is not changed for the state of current physical address.It is compared It is carried out for actual modification in the physical address to flash memory, hence it is evident that shorten modification time, improve modification efficiency.As a result, its It avoids general flash memory and completes the problem of corresponding all operations of trim order of one big segment data are by the long period is occupied, So as to respond within a short period of time host multiple big segment datas trim order request, when reducing the waiting of system Between, improve command response efficiency.
But due in trim command response method of the invention, during host system operation, only in memory into The modification of the corresponding mapping relations of row, after host system is powered off or shut down suddenly, the data in memory can lose therewith.Cause This, in order to guarantee still to be able to real-time response trim order, to improve the efficiency of the erasing operation of flash memory and then improve the reading of flash memory Write capability, referring to Fig. 1, further includes step S001 in trim command response method of the invention, when host system is powering off After when re-powering, the first trim order that real-time reception host actively issues, and being weighed in memory according to the first trim order Build corresponding first mapping relations.Wherein, the first mapping relations are the first specified logical address of the first trim order and its The mapping relations of corresponding first physical address.
That is, can be realized host by being loaded in host system and actively issue the application program of trim order, so that working as After host system power-off in powering on restarting process, the first trim order can be actively issued, and then again by flash controller root According to the first trim order that host actively issues, the first specified logical address of the first trim order is re-established in memory The mapping relations of its corresponding first physical address, to realize the purpose to the real-time response of trim order.
It should be noted that in order to actively issue trim life when realizing that host re-powers after host system power-off It enables, the required necessary information of the first trim order of generation can be collected by the way that the application program of operating system is arranged, and according to institute The necessary information of collection generates corresponding first trim order, to realize that host actively issues the purpose of the first trim order. Wherein, according to the difference of operating system, the implementation that corresponding necessary information generates and issues the first trim order is collected It is different.It such as, can be by the application layer directly calling of timing or not timing similar to fstrim when operating system is linux system Order is to realize that the active of the first trim order issues.For other operating systems, e.g., other are then can be used in Windows system Order or application program are realized.Details are not described herein again.
Specifically, referring to Fig. 3, for the more detailed implementation for illustrating host and actively issuing the first trim order, Below by taking operating system is linux system as an example, the generation of the first trim order is issued with active and is illustrated.
Firstly, executing step S010 when re-powering after host system power-off, fstrim life is called by application layer timing It enables, scans file system.Wherein, fstrim order is called in application layer timing, and scanning file system is the application of operating system Program, which is collected, generates the required necessary information of the first trim order.
And then pass through step S011, according to the scanning result to file system, not used sky in statistics file system again Between address.Wherein, not used space address is the necessary letter that application program is finally collected in the file system counted Breath.
Then step S012 is executed, the not used space address of statistics is packaged, the first trim order is packaged into, It is achieved in the generation of the first trim order.
Finally, executing step S013 again, the first trim order is sent, and the mapping for losing not used space address is closed System.The purpose that host actively issues the first trim order is finally realized as a result,.
After the first trim order of generation is issued to flash controller by host, host thens follow the steps S014 at this time, Until the return of the first trim order.Meanwhile flash controller then executes response and handles the operation of the first trim order.
Specifically, referring to fig. 4, step S015, the first trim that receiving host actively issues is first carried out in flash controller Order.Then step S016 is executed, according to the first trim order received, first is patrolled specified by the first trim order of acquisition Collect address.And then execute step S017, delete corresponding first physical address of the first logical address, establish the first logical address with The relationship between physical address after deleting the first physical address, to obtain the first mapping relations.Wherein, it needs to illustrate It is to delete the operation of the first physical address also in carrying out in memory.Host system is just completed as a result, to weigh after a loss of power Newly when powering on, mapping relations in memory are re-established.By carrying out re-establishing for the first mapping relations in memory, together Sample accelerates the response time of trim order.Finally, after re-establishing corresponding first mapping relations in memory, then execute The answer signal for indicating that the first trim order is completed is back to host by step S018.Meanwhile host executes step S019, connects The answer signal that flash controller returns is received, confirms that the mapping relations of file system are restored.It should be noted that institute at this time The first mapping relations and file system truthful data established not are one-to-one.It is intended merely to guarantee that host system opens The mapping relations cached in memory can be smoothly being modified during normal operation after dynamic, to guarantee the real-time of trim order Response.
That is, realizing that host actively issues the first trim order through the above steps, while flash controller receives And the operation of the first trim order is handled, finally realize the initialization of file system.Thus host system can be continued to execute to open After machine, processing and response in the current trim order during operation.That is, actively issuing the first trim order by host To flash controller, after replying corresponding first mapping relations in memory according to the first trim order by flash controller, then Issuing and handling for current trim order is carried out by scanning file system, so that the current mapping relations cached in memory It is corresponded with file system truthful data.
That is, being powered on when restarting after host system power-off, host actively the first tirm order that issues, is host File system initialization completion must carry out after system reboot.That is, only after the complete first tirm order of host active transmission, File system could normally provide read-write service, just calculate really initialization and complete.
In addition, it is necessary to explanation, in the embodiment of above-mentioned trim command response method, weight after host system power-off It when newly powering on, needs to be scanned file system, to generate corresponding first trim order, to realize that host actively issues The purpose of first trim order.In order to reduce the time of scanning file system, as trim command response method of the invention Another specific embodiment further includes storing the current mapping relations in memory to flash memory before host system power-off shutdown In step.That is, host system can receive corresponding shutdown command at this time when host system is that normal power down is shut down, from And it is waiting receive shutdown command, before power-off, after being modified according to the current trim order that receives for the last time at this time Current mapping relations store into flash memory.As a result, when host system powers on again, then it can be saved by first checking in flash memory Current mapping relations it is whether effective.If effectively, directly the current mapping relations of storage are written in memory, to be led The reception and processing of trim order during the operation of machine system.During it runs before host system power-off as a result, only The operation that data are once written into flash memory need to be carried out, and the time of scanning file system can also be saved, is further speeded up The starting speed of host system.If it is invalid, then by the scanning of host system progress file system, generate corresponding first Trim order.
Correspondingly, based on the same inventive concept, the present invention also provides a kind of trim command response systems.Due to the present invention The working principle of the trim command response system of offer is identical as the principle of trim command response method provided by the invention or phase Seemingly, therefore overlaps will not be repeated.
A specific embodiment referring to Fig. 5, as trim command response system 100 of the invention comprising trim order Issue module 110, logical address obtains module 120, mapping relations modified module 130 and trim command response module 140.Its In, trim order issues module 110, is configured as issuing current trim order.Logical address obtains module 120, is configured as The current trim order of real-time reception, and obtain the specified current logical address of current trim order.Mapping relations modified module 130, be configured as according to current trim order, modified in memory (not shown) current logical address with it is corresponding currently The current mapping relations of physical address.Trim command response module 140 is configured as mapping relations modified module 130 according to working as Preceding trim order, after modifying current mapping relations in memory, returning indicates the answer signal of current trim order completion to master Machine.
Simultaneously, it should be noted that trim order issues module 110, is additionally configured to host system after a loss of power again When powering on, the first trim order is actively issued.Correspondingly, logical address obtains module 120, it is additionally configured to receive the first trim Order.Mapping relations modified module 130 is then configured as rebuilding corresponding first mapping in memory according to the first trim order Relationship.Wherein, the first mapping relations be the first trim order specified by the first logical address its corresponding first physically The mapping relations of location.
Further, referring to Fig. 6, in a specific embodiment of trim command response system 100 of the invention, mapping is closed It is that modified module 130 includes logical address modification unit 131.Logical address modifies unit 131, is configured as by current logic The state of location is set as invalid state, and after trim command response module 140 returns to answer signal to host, current logic The state of the corresponding current physical address in location remains unchanged.That is, not to the shape of the corresponding current physical address of current logical address State carries out any modification.
In addition, it is necessary to explanation, referring to Fig. 6, trim order issue module 110 including file system scanning element 111, Space address statistic unit 112, order encapsulation unit 113 and order issuance unit 114.Wherein, file system scanning element 111, it is configured as scanning file system.Space address statistic unit 112 is configured as not used sky in statistics file system Between address.Order encapsulation unit 113 is configured as the not used space address of statistics being packaged into the first trim order.Life Issuance unit 114 is enabled, is configured as sending the first trim order, and abandon the mapping relations of not used space address.
Further, referring to Fig. 6, mapping relations modified module 130 further includes mapping relations modification unit 132.Wherein, Logical address obtains module 120, is additionally configured to obtain the first specified logic of the first trim order according to the first trim order Address.Mapping relations modify unit 132, then are configured as deleting corresponding first physical address of the first logical address, establish the The relationship between physical address after the first physical address of one logical address and deletion.
Additionally, it should be noted that the another specific embodiment as trim command response system of the invention, is also wrapped Include storage control module (not shown).Storage control module is configured as storing current mapping relations into flash memory.
Correspondingly, being based on any of the above-described kind of trim command response system, the present invention also provides a kind of operating systems.Its In, operating system includes host system, flash controller and any trim command response system as above.Wherein, trim Logical address in command response system obtains module, mapping relations modified module and trim command response module and is loaded in flash memory In controller.Trim order in trim command response system issues module and is loaded in host system.It by being in operation Any of the above-described kind of trim command response system of the invention is loaded in system, can effectively improve the read-write energy of the flash memory of operating system Power, to improve the performance of operating system.
The embodiments described above only express several embodiments of the present invention, and the description thereof is more specific and detailed, but simultaneously Limitations on the scope of the patent of the present invention therefore cannot be interpreted as.It should be pointed out that for those of ordinary skill in the art For, without departing from the inventive concept of the premise, various modifications and improvements can be made, these belong to guarantor of the invention Protect range.Therefore, the scope of protection of the patent of the invention shall be subject to the appended claims.

Claims (10)

1. a kind of trim command response method, which comprises the steps of:
The current trim order that receiving host issues;
Obtain the specified current logical address of the current trim order;
According to the current trim order, working as the current logical address and corresponding current physical address is modified in memory After preceding mapping relations, returning indicates the answer signal of the current trim order completion to the host, wherein in memory into The modification of the row current mapping relations includes modifying the state of current logical address;And
When host system re-powers after a loss of power, file system is scanned, generates corresponding first trim order, In, it further include storing the current mapping relations in the memory into flash memory before the host system power-off shutdown;
The first trim order that receiving host actively issues, and established in the memory according to the first trim order Corresponding first mapping relations;
Wherein, first mapping relations are specified the first logical address its corresponding first of the first trim order The mapping relations of physical address.
2. being repaired in memory the method according to claim 1, wherein described according to the current trim order When changing the current logical address with the current mapping relations of corresponding current physical address, including by the current logical address State the step of being set as invalid state;And
After returning to the answer signal to the host, the shape of the corresponding current physical address of the current logical address State remains unchanged.
3. the method according to claim 1, wherein also being wrapped when the host system re-powers after a loss of power Necessary information needed for including application program collection generation the first trim order of the host by operating system, and according to The step of necessary information generates and issues the corresponding first trim order;
Wherein, the necessary information includes not used space address in file system.
4. according to the method described in claim 3, it is characterized in that, the host collects life by the application program of operating system At the necessary information needed for the first trim order, and is generated according to the necessary information and issue corresponding described first Trim order, includes the following steps:
Scan the file system;
Count not used space address in the file system;
The not used space address of statistics is packaged into the first trim order;
The first trim order is sent, and abandons the mapping relations of the not used space address.
5. method according to claim 1 or 4, which is characterized in that it is described according to the first trim order described interior Middle corresponding first mapping relations of reconstruction are deposited, are included the following steps:
According to the first trim order, specified first logical address of the first trim order is obtained;
Corresponding first physical address of first logical address is deleted, is established described in first logical address and deletion The relationship between physical address after first physical address.
6. a kind of trim command response system, which is characterized in that including trim order issue module, logical address obtain module, Mapping relations modified module and trim command response module;
The trim order issues module, is configured as issuing current trim order;
The logical address obtains module, is configured as receiving the current trim order, and obtain the current trim order Specified current logical address;
The mapping relations modified module, is configured as according to the current trim order, modifies described currently patrol in memory Collect the current mapping relations of address and corresponding current physical address;
The trim command response module, is configured as the mapping relations modified module according to the current trim order, After modifying the current mapping relations in memory, return indicate the answer signal of the current trim order completion to host, In, the modification for carrying out the current mapping relations in memory includes modifying the state of current logical address;
The trim order issues module, when being additionally configured to host system and re-powering after a loss of power, carries out to file system Scanning generates corresponding first trim order, actively issues the first trim order, wherein powers off in the host system It further include storing the current mapping relations in the memory into flash memory before shutdown;
The logical address obtains module, is additionally configured to receive the first trim order;
The mapping relations modified module is configured as rebuilding corresponding in the memory according to the first trim order One mapping relations;
Wherein, first mapping relations are specified the first logical address its corresponding first of the first trim order The mapping relations of physical address.
7. system according to claim 6, which is characterized in that the mapping relations modified module includes logical address modification Unit;
The logical address modifies unit, is configured as setting invalid state for the state of the current logical address, and work as After the trim command response module returns to the answer signal to the host, the current logical address is corresponding described to work as The state of preceding physical address remains unchanged.
8. system according to claim 6, which is characterized in that it includes file system scanning that the trim order, which issues module, Unit, space address statistic unit, order encapsulation unit and order issuance unit;
The file system scanning element is configured as scanning file system;
The space address statistic unit is configured as counting not used space address in the file system;
The order encapsulation unit is configured as the not used space address of statistics being packaged into the first trim life It enables;
The order issuance unit is configured as sending the first trim order, and abandons the not used space address Mapping relations.
9. the system according to claim 6 or 8, which is characterized in that the mapping relations modified module further includes that mapping is closed System's modification unit;
The logical address obtains module, is configured as obtaining the first trim order according to the first trim order and referring to The first fixed logical address;
The mapping relations modify unit, are configured as deleting corresponding first physical address of first logical address, establish The relationship between physical address after first logical address and deletion first physical address.
10. a kind of operating system, which is characterized in that including any one of host system, flash controller and claim 6 to 9 institute The trim command response system stated;
Wherein, the logical address in the trim command response system obtains module, mapping relations modified module and trim order Responder module is loaded in the flash controller;
Trim order in the trim command response system issues module and is loaded in the host system.
CN201610089522.2A 2016-02-17 2016-02-17 Trim command response method and system and operating system Active CN105760311B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610089522.2A CN105760311B (en) 2016-02-17 2016-02-17 Trim command response method and system and operating system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610089522.2A CN105760311B (en) 2016-02-17 2016-02-17 Trim command response method and system and operating system

Publications (2)

Publication Number Publication Date
CN105760311A CN105760311A (en) 2016-07-13
CN105760311B true CN105760311B (en) 2019-08-30

Family

ID=56330892

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610089522.2A Active CN105760311B (en) 2016-02-17 2016-02-17 Trim command response method and system and operating system

Country Status (1)

Country Link
CN (1) CN105760311B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018041258A1 (en) * 2016-09-05 2018-03-08 北京忆恒创源科技有限公司 Method for processing de-allocation command, and storage device
TWI634424B (en) * 2017-05-08 2018-09-01 慧榮科技股份有限公司 Data storage device and operating method therefor
EP3696681B1 (en) 2017-11-07 2023-12-20 Huawei Technologies Co., Ltd. Memory block recovery method and device
CN109240939B (en) * 2018-08-15 2023-04-07 杭州阿姆科技有限公司 Method for rapidly processing solid state disk TRIM
CN111240590A (en) * 2020-01-03 2020-06-05 北京小米移动软件有限公司 Dirty data erasing method, dirty data erasing device and electronic equipment
CN112765051B (en) * 2021-01-22 2022-12-20 珠海妙存科技有限公司 Method, device and medium for reducing trim consumption of flash memory device
CN113031866B (en) * 2021-03-24 2022-08-05 山东华芯半导体有限公司 Trim management method applied to SSD
CN116893853B (en) * 2023-09-11 2023-12-12 合肥康芯威存储技术有限公司 Storage device and processing method of erasing instruction

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102467455A (en) * 2010-10-29 2012-05-23 三星电子株式会社 Memory system, data storage device, user device and data management method thereof
CN102662606A (en) * 2012-03-12 2012-09-12 记忆科技(深圳)有限公司 Raid configuration information processing method and raid controller
CN103019971A (en) * 2012-11-25 2013-04-03 向志华 Method of quickly responding to trim command, SSD (Solid State Disk) controller and system
US9026699B2 (en) * 2013-09-23 2015-05-05 Seagate Technology Llc Command execution using existing address information

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102467455A (en) * 2010-10-29 2012-05-23 三星电子株式会社 Memory system, data storage device, user device and data management method thereof
CN102662606A (en) * 2012-03-12 2012-09-12 记忆科技(深圳)有限公司 Raid configuration information processing method and raid controller
CN103019971A (en) * 2012-11-25 2013-04-03 向志华 Method of quickly responding to trim command, SSD (Solid State Disk) controller and system
US9026699B2 (en) * 2013-09-23 2015-05-05 Seagate Technology Llc Command execution using existing address information

Also Published As

Publication number Publication date
CN105760311A (en) 2016-07-13

Similar Documents

Publication Publication Date Title
CN105760311B (en) Trim command response method and system and operating system
US8086765B2 (en) Direct I/O device access by a virtual machine with memory managed using memory disaggregation
CN102012791B (en) Flash based PCIE (peripheral component interface express) board for data storage
CN107193758A (en) The mapping table management method and solid state hard disc of a kind of solid state hard disc
US9507719B2 (en) Garbage collection in hybrid memory system
CN107209719B (en) A kind of array control unit, solid state disk and the method for controlling solid state disk write data
CN105224474B (en) The realization system of solid state hard disk flash translation layer (FTL) and the realization device of flash translation layer (FTL)
CN104407933B (en) A kind of backup method and device of data
US20150127896A1 (en) Storage system and storage method
US10802734B2 (en) Method for fast boot read
CN103019971A (en) Method of quickly responding to trim command, SSD (Solid State Disk) controller and system
CN110515859A (en) A kind of solid state disk read-write request method for parallel processing
US10423354B2 (en) Selective data copying between memory modules
US20190042462A1 (en) Checkpointing for dram-less ssd
CN107818052A (en) Memory pool access method and device
CN100377117C (en) Method and device for converting virtual address, reading and writing high-speed buffer memory
CN108733321A (en) Garbage collection-automaticdata is placed
CN109783396A (en) The method of access flash memory module and relevant flash controller and electronic device
CN107391392A (en) A kind of garbage reclamation optimization method based on flash memory device Concurrent Feature
US8914587B2 (en) Multi-threaded memory operation using block write interruption after a number or threshold of pages have been written in order to service another request
CN106598493A (en) Solid state disk address mapping table management method
CN109117383A (en) Method for managing flash memory module and flash memory controller
CN109697170A (en) The method of access flash memory module and relevant flash controller and electronic device
CN109240939A (en) A kind of method of quick processing solid state hard disk TRIM
CN106909516A (en) Storage system and its operating 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
GR01 Patent grant
GR01 Patent grant