TWI811573B - Storage device and accessing method for operation log thereof - Google Patents

Storage device and accessing method for operation log thereof Download PDF

Info

Publication number
TWI811573B
TWI811573B TW109136047A TW109136047A TWI811573B TW I811573 B TWI811573 B TW I811573B TW 109136047 A TW109136047 A TW 109136047A TW 109136047 A TW109136047 A TW 109136047A TW I811573 B TWI811573 B TW I811573B
Authority
TW
Taiwan
Prior art keywords
storage device
flash memory
running log
memory
storage
Prior art date
Application number
TW109136047A
Other languages
Chinese (zh)
Other versions
TW202217804A (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 大陸商合肥沛睿微電子股份有限公司
Priority to TW109136047A priority Critical patent/TWI811573B/en
Publication of TW202217804A publication Critical patent/TW202217804A/en
Application granted granted Critical
Publication of TWI811573B publication Critical patent/TWI811573B/en

Links

Landscapes

  • Debugging And Monitoring (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

A storage device is capable of executing an accessing method of an operation log. The method includes configuring a buffering area of a memory and caching an operation log of a storage device in the buffering area; writing the operation log into a specific storage area of a flash and modifying an offset of a storage block of the memory; releasing the buffering area for re-caching an operation log; periodically updating the flash according to the storage block; starting a watch-dog circuit when the storage device starts initialization; reading the specific storage area of the flash to obtain the latest operation log when the watch-dog circuit counts to a predetermined number and the storage device has not finish the initialization; and closing the watch-dog circuit when the storage device finishes the initialization.

Description

儲存裝置及其運行日誌的存取方法Storage device and its operation log access method

本申請涉及日誌記錄技術領域,尤其涉及一種儲存裝置及其運行日誌的存取方法。 The present application relates to the field of log recording technology, and in particular, to a storage device and a method for accessing its operation log.

隨著儲存裝置(例如:固態硬碟(Solid-state drive,SSD))的應用領域日益廣泛,對儲存裝置的穩定性要求也越來越高。 As the application fields of storage devices (such as solid-state drives (SSD)) become increasingly widespread, the requirements for the stability of storage devices are also getting higher and higher.

先前技術會在儲存裝置運行過程中,記錄使用者對儲存裝置的操作資訊、告警資訊等,形成運行日誌檔保存在儲存裝置中。然而,這種方式存在局限性,如果儲存裝置的控制器的快閃記憶體的轉換層損壞時,會造成無法辨識儲存裝置(不認盤),檔案系統丟失,那麼將無法讀取運行日誌檔。儲存裝置的控制器的快閃記憶體轉換層損壞時,當然此時的儲存裝置也無法順利完成初始化的程序。若儲存裝置已發生不認盤的現象,僅能通過拆解儲存裝置的殼體的方式進行問題分析,但由於儲存裝置通常已封裝完成,如果需要拆殼分析問題,操作會比較複雜。 The previous technology will record the user's operation information, alarm information, etc. on the storage device during the operation of the storage device, and form an operation log file and save it in the storage device. However, this method has limitations. If the translation layer of the flash memory of the controller of the storage device is damaged, the storage device will not be recognized (the disk will not be recognized), the file system will be lost, and the run log file will not be read. . When the flash memory conversion layer of the controller of the storage device is damaged, of course the storage device at this time cannot successfully complete the initialization process. If the storage device does not recognize the disk, the problem can only be analyzed by disassembling the casing of the storage device. However, since the storage device is usually packaged, if it is necessary to disassemble the casing to analyze the problem, the operation will be more complicated.

本申請實施例提供一種運行日誌的存取方法及儲存裝置,解決先前技術所存在快閃記憶體轉換層損壞時無法讀取運行日誌的問題。 Embodiments of the present application provide a method and storage device for accessing a running log, which solves the problem in the prior art that the running log cannot be read when the flash memory conversion layer is damaged.

為了解決上述技術問題,本申請是這樣實現的: In order to solve the above technical problems, this application is implemented as follows:

第一方面,提供了一種運行日誌的存取方法,應用於儲存裝置,儲存裝置包括目標記憶體、快閃記憶體和控制器,運行日誌的存取方法包括下列步驟:(a)設置目標記憶體的緩衝區域且暫存儲存裝置的運行日誌於目標記憶體的緩衝區域;(b)將緩衝區域內的運行日誌寫入快閃記憶體的特定儲存區域,並於寫入完畢後修改目標記憶體的儲存區塊所紀錄的偏移值,且釋放目標記憶體的緩衝區域,以重新執行步驟(a),其中,偏移值對應於緩衝區域內的運行日誌寫入特定儲存區域的位置;(c)每隔一段預定時間將儲存區塊更新至快閃記憶體;(d)當儲存裝置進入初始化階段時,啟動控制器的看門狗電路;(e)當看門狗電路計數一預設計數時間過後且儲存裝置未完成初始化階段時,儲存裝置被設置成強制低階格式化模式,通過讀取快閃記憶體的特定儲存區域,進而獲取最新的運行日誌;(f)當儲存裝置完成初始化階段時,關閉看門狗電路。 In the first aspect, a method for accessing a running log is provided, which is applied to a storage device. The storage device includes a target memory, a flash memory and a controller. The method for accessing a running log includes the following steps: (a) Setting the target memory and temporarily store the running log of the device in the buffer area of the target memory; (b) write the running log in the buffer area to a specific storage area of the flash memory, and modify the target memory after the writing is completed The offset value recorded in the storage block of the target memory is released, and the buffer area of the target memory is released to re-execute step (a), where the offset value corresponds to the position where the running log in the buffer area is written to the specific storage area; (c) Update the storage block to the flash memory at predetermined intervals; (d) When the storage device enters the initialization phase, start the watchdog circuit of the controller; (e) When the watchdog circuit counts one After the preset count time has passed and the storage device has not completed the initialization phase, the storage device is set to a forced low-level format mode to obtain the latest operating log by reading a specific storage area of the flash memory; (f) When storing When the device completes the initialization phase, the watchdog circuit is turned off.

第二方面,提供一種儲存裝置,包括目標記憶體、快閃記憶體和控制器,目標記憶體和快閃記憶體分別與控制器連接,控制器包括:非揮發性記憶體和處理器。其中,非揮發性記憶體用於儲存實現運行日誌的存取方法的程式碼。處理器耦接非揮發性記憶體,用於載入運行日誌的存取方法的程式碼,以執行下列步驟:(a)設置目標記憶體的緩衝區域且暫存儲存裝置的運行日誌於目標記憶體的緩衝區域;(b)將緩衝區域內的運行日誌寫入快閃記憶體的特定儲存區域,並於寫入完畢後修改目標記憶體的儲存區塊所紀錄的偏移值,且釋放目標記憶體的緩衝區域,以重新執行步驟(a),其中,偏移值對應於緩衝區域內的運行日誌寫入特定儲存區域的位置;(c)每隔一段預定時間將儲存區塊更新至快閃記 憶體;(d)當儲存裝置進入初始化階段時,啟動控制器的看門狗電路;(e)當看門狗電路計數一預設計數時間過後且儲存裝置未完成初始化階段時,儲存裝置被設置成強制低階格式化模式,通過讀取快閃記憶體的特定儲存區域,進而獲取最新的運行日誌;(f)當儲存裝置完成初始化階段時,關閉看門狗電路。 In a second aspect, a storage device is provided, including a target memory, a flash memory and a controller. The target memory and the flash memory are respectively connected to the controller. The controller includes a non-volatile memory and a processor. Among them, the non-volatile memory is used to store the program code that implements the access method of the running log. The processor is coupled to the non-volatile memory and is used to load the program code of the access method of the running log to perform the following steps: (a) setting a buffer area of the target memory and temporarily storing the running log of the device in the target memory (b) Write the running log in the buffer area to a specific storage area of the flash memory, and after the writing is completed, modify the offset value recorded in the storage block of the target memory, and release the target The buffer area of the memory to re-execute step (a), where the offset value corresponds to the location where the running log in the buffer area is written to the specific storage area; (c) update the storage block to the cache area at predetermined intervals flash memory memory; (d) when the storage device enters the initialization phase, start the watchdog circuit of the controller; (e) when the watchdog circuit counts a preset count time and the storage device does not complete the initialization phase, the storage device It is set to a forced low-level formatting mode and obtains the latest operating log by reading a specific storage area of the flash memory; (f) When the storage device completes the initialization phase, the watchdog circuit is turned off.

在本申請實施例中,通過在儲存裝置運行過程中,將其運行日誌記錄在快閃記憶體的固定位置(即特定儲存區域),使得運行日誌的紀錄不受檔案系統的影響;同時,使用看門狗電路運行在儲存裝置初始化階段,配合儲存裝置的自我檢測判斷機制,如果發現儲存裝置在預定時間內未完成初始化階段時,看門狗電路會觸發以將儲存裝置設置成強制低階格式化模式,直接讀取快閃記憶體的特定儲存區域,進而獲取最新的運行日誌,以此保證在不拆解儲存裝置的外殼的情況下,可以獲取運行日誌。因此,當儲存裝置發生不可預知的現象時,可以獲取運行日誌資訊,並通過獲取的運行日誌分析原因。 In the embodiment of the present application, by recording the operation log in a fixed location of the flash memory (ie, a specific storage area) during the operation of the storage device, the recording of the operation log is not affected by the file system; at the same time, using The watchdog circuit runs during the initialization phase of the storage device and cooperates with the self-detection and judgment mechanism of the storage device. If it is found that the storage device has not completed the initialization phase within a predetermined time, the watchdog circuit will be triggered to set the storage device to a forced low-level format. mode, directly read the specific storage area of the flash memory, and then obtain the latest running log, thus ensuring that the running log can be obtained without disassembling the casing of the storage device. Therefore, when an unpredictable phenomenon occurs in the storage device, the running log information can be obtained, and the cause can be analyzed through the obtained running log.

100:儲存裝置 100:Storage device

110:記憶體(目標記憶體) 110: Memory (target memory)

112:緩衝區域 112: Buffer area

114:儲存區塊 114:Storage block

116:隨機存取記憶磁碟 116: Random access memory disk

120:快閃記憶體 120: Flash memory

122:儲存區域 122:Storage area

130:控制器 130:Controller

132:主機介面 132:Host interface

134:處理器 134: Processor

136:快閃記憶體介面 136:Flash memory interface

138:非揮發性記憶體 138:Non-volatile memory

140:看門狗電路 140:Watchdog circuit

S212:步驟 S212: Step

S214:步驟 S214: Step

S216:步驟 S216: Step

S218:步驟 S218: Step

S220:步驟 S220: Steps

S222:步驟 S222: Step

S412:步驟 S412: Step

S414:步驟 S414: Step

S416:步驟 S416: Step

S418:步驟 S418: Step

S420:步驟 S420: Steps

S422:步驟 S422: Step

此處所說明的圖式用來提供對本申請的進一步理解,構成本申請的一部分,本申請的示意性實施例及其說明用於解釋本申請,並不構成對本申請的不當限定。在圖式中:圖1為依據本發明實施例的儲存裝置的功能方塊圖。 The drawings described here are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation of the present application. In the drawings: FIG. 1 is a functional block diagram of a storage device according to an embodiment of the present invention.

圖2為依據本發明實施例的控制器的功能方塊圖。 FIG. 2 is a functional block diagram of a controller according to an embodiment of the present invention.

圖3為依據本發明的運行日誌的存取方法的一實施例方法流程圖。 FIG. 3 is a method flow chart of an embodiment of a running log access method according to the present invention.

圖4為依據本發明的運行日誌的存取方法的另一實施例方法流程圖。 FIG. 4 is a method flow chart of another embodiment of the running log access method according to the present invention.

以下將配合相關附圖來說明本發明的實施例。在這些附圖中,相同的標號表示相同或類似的元件或方法流程。 The embodiments of the present invention will be described below with reference to relevant drawings. In the drawings, the same reference numerals represent the same or similar elements or process flows.

必須瞭解的是,使用在本說明書中的“包含”、“包括”等詞,是用於表示存在特定的技術特徵、數值、方法步驟、作業處理、元件和/或元件,但並不排除可加上更多的技術特徵、數值、方法步驟、作業處理、元件、元件,或以上的任意組合。 It must be understood that the words "including" and "include" used in this specification are used to indicate the existence of specific technical features, numerical values, method steps, work processes, components and/or components, but do not exclude the possibility of Plus further technical features, values, method steps, processes, components, components, or any combination of the above.

本發明中使用如“第一”、“第二”、“第三”等詞是用來修飾請求項中的元件,並非用來表示之間具有優先權順序,先行關係,或者是一個元件先於另一個元件,或者是執行方法步驟時的時間先後順序,僅用來區別具有相同名字的元件。 The use of words such as "first", "second" and "third" in the present invention are used to modify the elements in the request, and are not used to indicate that there is a priority order or precedence relationship between them, or that one element comes first. to another component, or the time sequence when executing method steps, and is only used to distinguish components with the same name.

必須瞭解的是,當元件描述為“連接”或“耦接”至另一元件時,可以是直接連結、或耦接至其他元件,可能出現中間元件。相反地,當元件描述為“直接連接”或“直接耦接”至另一組件時,其中不存在任何中間組件。另外,除非說明書中特別指明,否則任何單數格的用語都同時包含複數格的涵義。 It must be understood that when an element is described as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element, and intervening elements may be present. In contrast, when an element is described as being "directly connected" or "directly coupled" to another component, there are no intervening components present. In addition, unless otherwise specified in the specification, any term in the singular shall also include the plural.

請參閱圖1,其為依據本發明實施例的儲存裝置的功能方塊圖;如圖所示,本實施例的儲存裝置100可包括記憶體110(亦可稱目標記憶體)、快閃記憶體120和控制器130,記憶體110和快閃記憶體120分別與控制器130電性連接,以進行資訊與資料的傳遞。其中,儲存裝置100可包括通用序列匯流排(USB)記憶體裝置、具有各種介面的儲存卡、通用 快閃記憶體(UFS)裝置、固態硬碟(SSD)等。 Please refer to Figure 1, which is a functional block diagram of a storage device according to an embodiment of the present invention; as shown in the figure, the storage device 100 of this embodiment may include a memory 110 (also called a target memory), a flash memory 120 and the controller 130, the memory 110 and the flash memory 120 are electrically connected to the controller 130 respectively to transfer information and data. The storage device 100 may include a universal serial bus (USB) memory device, a memory card with various interfaces, a universal Flash memory (UFS) devices, solid state drives (SSD), etc.

本實施例的快閃記憶體120包括用來儲存讀寫資料的多個資料區塊,每一資料區塊包括多個實體頁面(Page),每一實體頁面都具有個別的實體位址;其中,快閃記憶體120為非揮發性記憶體(Non-volatile memory,亦可稱非易失性記憶體),使用時讀寫速度相對較慢,斷電後其內儲存的資料等能夠持續保存較長時間。本實施例的快閃記憶體120預留有一個特定儲存區域122,用於儲存來自記憶體110所暫存的儲存裝置100的運行日誌。在一實施例中,特定儲存區域122包括多個依序排列的資料區塊。 The flash memory 120 of this embodiment includes multiple data blocks used to store read and write data. Each data block includes multiple physical pages (Pages), and each physical page has an individual physical address; where , the flash memory 120 is a non-volatile memory (Non-volatile memory, also called a non-volatile memory). The read and write speed is relatively slow during use, and the data stored in it can be continuously saved after a power outage. longer time. The flash memory 120 of this embodiment reserves a specific storage area 122 for storing the running logs from the storage device 100 temporarily stored in the memory 110 . In one embodiment, the specific storage area 122 includes a plurality of data blocks arranged in sequence.

本實施例的記憶體110預留有一個緩衝區域112(也就是設置記憶體110的緩衝區域112),用於暫存儲存裝置100的運行日誌,且包括儲存區塊114,用於儲存區域映射表和頁面映射表,所述區域映射表用於映射快閃記憶體120中用來儲存讀寫資料的每一資料區塊的邏輯位址與實體位址,而每一個資料區塊都會對應有各自的頁面映射表,用於儲存每一頁面的邏輯位址與實體位址的關聯;其中,記憶體110為揮發性記憶體(Volatile memory,亦可稱易失性記憶體),使用時讀寫速度較快,斷電後其內儲存的資料等即刻消失;記憶體110用於暫存控制器130執行存取運作所需的資料;當控制器130啟用記憶體110上的隨機存取記憶磁碟(RAM disk)116後,則在記憶體110中劃分出一個記憶體空間供隨機存取記憶磁碟116使用。 The memory 110 of this embodiment reserves a buffer area 112 (that is, the buffer area 112 of the memory 110 is set) for temporarily storing the running log of the storage device 100, and includes a storage block 114 for storing area mapping. table and page mapping table. The area mapping table is used to map the logical address and physical address of each data block used to store read and write data in the flash memory 120, and each data block will correspond to The respective page mapping table is used to store the relationship between the logical address and the physical address of each page; among them, the memory 110 is a volatile memory (Volatile memory, also called a volatile memory), which is read during use. The writing speed is fast, and the data stored in it will disappear immediately after the power is turned off; the memory 110 is used to temporarily store the data required by the controller 130 to perform access operations; when the controller 130 enables the random access memory on the memory 110 After the RAM disk 116 is installed, a memory space is divided in the memory 110 for use by the random access memory disk 116 .

請參閱圖2,其為依據本發明實施例的控制器的功能方塊圖。控制器130可包括主機介面132、處理器134、快閃記憶體介面136、 非揮發性記憶體(Non-volatile memory)138和看門狗電路(watchdog circuit,亦可稱監視電路)140。非揮發性記憶體138用於儲存實現運行日誌的存取方法的程式碼,例如:可以使用唯讀記憶體(ROM,Read Only Memory)、可抹除可程式設計唯讀記憶體(EPROM,Erasable Programmable Read Only Memory)、電子可抹除可程式設計唯讀記憶體(EEPROM,Electrically-Erasable Programmable Read-Only Memory)等來實現。處理器134可使用通用硬體(例如,單一處理器、具平行處理能力的多處理器、圖形處理器或其他具運算能力的處理器)來實現,並且在載入與執行實現運行日誌的存取方法的程式碼時,完成以下描述的運行日誌的存取方法。主機介面132可通過序列先進技術附件(Serial advanced technology attachment,SATA)、快速周邊元件互聯(Peripheral component interconnect express,PCI-E)、通用序列匯流排(Universal serial bus,USB)的介面及關聯的通訊協定從外部主機(Host)接收讀取、寫入、抹除等命令,以及相關參數與資料,然後據以執行。快閃記憶體介面136耦接快閃記憶體120,處理器134耦接主機介面132、快閃記憶體介面136、非揮發性記憶體138和看門狗電路140。處理器134可以通過主機介面132與主機通訊,並且通過快閃記憶體介面136與快閃記憶體120通訊。快閃記憶體介面136包含多個暫存器,讓處理器134可通過改變暫存器的內容來調整快閃記憶體介面136的物理設置(Physical configurations)。看門狗電路140用於在儲存裝置100進入初始化階段時被處理器134啟動;在初始化階段,控制器130進行自我檢測機制,當看門狗電路140計數一預設計數時間過後且儲存裝置100未完成初始化階段 時,看門狗電路140會觸發處理器134使得儲存裝置100被設置成強制低階格式化模式(Force Low Level Format Mode,Force LLF Mode),且於記憶體110上啟用隨機存取記憶磁碟116,以保證儲存裝置100與前端主機的連接;當控制器130判斷儲存裝置100完成初始化階段時(代表著該快閃記憶體轉換層是正確、未損壞的狀態),處理器134關閉看門狗電路140。 Please refer to FIG. 2 , which is a functional block diagram of a controller according to an embodiment of the present invention. The controller 130 may include a host interface 132, a processor 134, a flash memory interface 136, Non-volatile memory (Non-volatile memory) 138 and watchdog circuit (watchdog circuit, also called monitoring circuit) 140. The non-volatile memory 138 is used to store the program code that implements the access method of the running log. For example, a read-only memory (ROM, Read Only Memory), an erasable programmable read-only memory (EPROM, Erasable) can be used. Programmable Read Only Memory), Electronically Erasable Programmable Read-Only Memory (EEPROM, Electrically-Erasable Programmable Read-Only Memory), etc. The processor 134 can be implemented using general-purpose hardware (for example, a single processor, multiple processors with parallel processing capabilities, a graphics processor, or other processors with computing capabilities), and implements the storage of run logs during loading and execution. When retrieving the code of the method, complete the access method of the run log described below. The host interface 132 may use Serial advanced technology attachment (SATA), Peripheral component interconnect express (PCI-E), Universal serial bus (USB) interfaces and associated communications. The protocol receives read, write, erase and other commands from the external host (Host), as well as related parameters and data, and then executes them accordingly. The flash memory interface 136 is coupled to the flash memory 120 , and the processor 134 is coupled to the host interface 132 , the flash memory interface 136 , the non-volatile memory 138 and the watchdog circuit 140 . Processor 134 may communicate with the host through host interface 132 and with flash memory 120 through flash memory interface 136 . The flash memory interface 136 includes a plurality of registers, allowing the processor 134 to adjust the physical configurations of the flash memory interface 136 by changing the contents of the registers. The watchdog circuit 140 is used to be started by the processor 134 when the storage device 100 enters the initialization phase; during the initialization phase, the controller 130 performs a self-detection mechanism. When the watchdog circuit 140 counts a preset counting time and the storage device 100 Initialization phase not completed At this time, the watchdog circuit 140 triggers the processor 134 to set the storage device 100 to the Force Low Level Format Mode (Force LLF Mode) and enable the random access memory disk on the memory 110 116, to ensure the connection between the storage device 100 and the front-end host; when the controller 130 determines that the storage device 100 has completed the initialization phase (representing that the flash memory translation layer is in a correct and undamaged state), the processor 134 closes the watch gate Dog circuit 140.

為了克服如上所述先前技術所存在快閃記憶體轉換層損壞時無法讀取運行日誌的問題,本發明實施例提出一種運行日誌的存取方法,處理器134通過在儲存裝置100運行過程中,先暫存其運行日誌於記憶體110中所設置的緩衝區域112,將暫存的運行日誌記錄在快閃記憶體120的固定位置(即特定儲存區域122),並且修改記憶體110的儲存區塊114所紀錄的偏移值(即區域映射表),且釋放記憶體110的緩衝區域112,以使記憶體110的緩衝區域112重新執行暫存運行日誌的操作,使得運行日誌的紀錄不受檔案系統的影響;每隔一段預定時間將儲存區塊114更新至快閃記憶體120;此外,在儲存裝置100進入初始化階段時,啟動控制器130的看門狗電路140,且配合儲存裝置100的自我檢測判斷機制,如果快閃記憶體轉換層有損壞(即,看門狗電路140計數一預設計數時間過後且儲存裝置100無法順利完成初始化階段)時,看門狗電路140會觸發處理器134,以使得儲存裝置100設置成強制低階格式化模式,通過讀取快閃記憶體120的特定儲存區域122,進而獲取最新的運行日誌,如此可在不拆解儲存裝置100的外殼的情況下,可以獲取運行日誌。因此,當儲存裝置100發生不可預知的現象時,可以獲取運行日誌,並通過獲取的運行日誌分析原因。詳細說明如後: 在一實施例中,控制器130的處理器134載入運行日誌的存取方法的程式碼時以實現運行日誌的存取方法,可以參考如圖3,圖3為依據本發明的運行日誌的存取方法的一實施例方法流程圖,詳細說明如下。 In order to overcome the problem in the prior art that the running log cannot be read when the flash memory conversion layer is damaged, an embodiment of the present invention proposes a method for accessing the running log. The processor 134 performs First, temporarily store the running log in the buffer area 112 set in the memory 110, record the temporary running log in a fixed location of the flash memory 120 (ie, the specific storage area 122), and modify the storage area of the memory 110. The offset value recorded in block 114 (i.e., the area mapping table) is released, and the buffer area 112 of the memory 110 is released, so that the buffer area 112 of the memory 110 can re-execute the operation of temporarily storing the running log, so that the record of the running log is not affected by the Influence of the file system; the storage block 114 is updated to the flash memory 120 at predetermined intervals; in addition, when the storage device 100 enters the initialization phase, the watchdog circuit 140 of the controller 130 is activated and cooperates with the storage device 100 A self-detection and judgment mechanism, if the flash memory conversion layer is damaged (that is, the watchdog circuit 140 counts a preset counting time and the storage device 100 cannot successfully complete the initialization phase), the watchdog circuit 140 will trigger The processor 134 sets the storage device 100 to a forced low-level format mode by reading the specific storage area 122 of the flash memory 120 to obtain the latest running log, so that the casing of the storage device 100 can be obtained without disassembling the casing of the storage device 100. In this case, you can obtain the running log. Therefore, when an unpredictable phenomenon occurs in the storage device 100, the operation log can be obtained, and the cause can be analyzed through the obtained operation log. Detailed description is as follows: In one embodiment, when the processor 134 of the controller 130 loads the program code of the access method of the run log to implement the access method of the run log, please refer to Figure 3. Figure 3 shows the run log according to the present invention. A method flow chart of an embodiment of the access method is described in detail as follows.

步驟S212:設置所述記憶體110的一緩衝區域112且暫存所述儲存裝置100的運行日誌於所述記憶體110的緩衝區域112。 Step S212: Set a buffer area 112 of the memory 110 and temporarily store the running log of the storage device 100 in the buffer area 112 of the memory 110.

步驟S214:將所述緩衝區域112內的所述運行日誌寫入所述快閃記憶體120的特定儲存區域122,並於寫入完畢後修改所述記憶體110的儲存區塊114所紀錄的偏移值,且釋放所述記憶體110的所述緩衝區域112,以重新暫存所述儲存裝置100的所述運行日誌。其中,所述偏移值對應於所述緩衝區域112內的所述運行日誌寫入所述特定儲存區域122的位置。也就是說,處理器134將緩衝區域112所暫存的運行日誌寫入(Program,亦可稱編程)快閃記憶體120的特定儲存區域122,具體而言,是依據記憶體110的儲存區塊114所儲存的區域映射表和頁面映射表以動態偏移值方式將緩衝區域112所暫存的運行日誌寫入到快閃記憶體120的特定儲存區域122,隨後便更新相對應的區域映射表和頁面映射表的邏輯位址與實體位址的連結關係(即於寫入完畢後修改所述記憶體110的儲存區塊114所紀錄的偏移值),以提供之後讀寫時的對應使用。此外,於寫入完畢後釋放所述記憶體110的所述緩衝區域112,以重新暫存所述儲存裝置100的所述運行日誌。其中,所述特定儲存區域122循環使用,如果寫到了最後,再重新從頭開始使用。 Step S214: Write the running log in the buffer area 112 to the specific storage area 122 of the flash memory 120, and modify the data recorded in the storage block 114 of the memory 110 after the writing is completed. offset value, and release the buffer area 112 of the memory 110 to re-temporarily store the running log of the storage device 100 . The offset value corresponds to the position where the running log in the buffer area 112 is written to the specific storage area 122 . That is to say, the processor 134 writes (Program, also called programming) the running log temporarily stored in the buffer area 112 into the specific storage area 122 of the flash memory 120. Specifically, based on the storage area of the memory 110 The area mapping table and page mapping table stored in block 114 write the running log temporarily stored in the buffer area 112 to the specific storage area 122 of the flash memory 120 in the form of dynamic offset values, and then update the corresponding area mapping. The connection relationship between the logical address and the physical address of the table and page mapping table (that is, the offset value recorded in the storage block 114 of the memory 110 is modified after the writing is completed) to provide correspondence during subsequent reading and writing. use. In addition, after the writing is completed, the buffer area 112 of the memory 110 is released to re-temporarily store the running log of the storage device 100 . The specific storage area 122 is used cyclically. If the writing reaches the end, it will be used from the beginning again.

在一種可選的實施方式中,每當所述緩衝區域112已滿時,所述處理器134才將所述緩衝區域112內的所述運行日誌寫入所述快閃記 憶體120的所述特定儲存區域122,並於寫入完畢後修改所述記憶體110的所述儲存區塊114所紀錄的所述偏移值,且釋放所述記憶體110的所述緩衝區域112,以重新暫存所述儲存裝置100的所述運行日誌。 In an optional implementation, whenever the buffer area 112 is full, the processor 134 writes the running log in the buffer area 112 to the flash memory. The specific storage area 122 of the memory 120 is modified, and after the writing is completed, the offset value recorded in the storage block 114 of the memory 110 is modified, and the buffer of the memory 110 is released. Area 112 to re-stage the running log of the storage device 100 .

在一種可選的實施方式中,所述快閃記憶體120的所述特定儲存區域122包括多個資料區塊,每一資料區塊的大小和緩衝區域112的大小相同(例如:4KB,4,000位元組),使得每當所述緩衝區域112已滿時,由所述快閃記憶體120的所述特定儲存區域122的第一個資料區塊開始寫入緩衝區域112內的運行日誌;當快閃記憶體120的所述特定儲存區域122的最後一個資料區塊接續寫入緩衝區域112內的所述運行日誌後,則再使所述快閃記憶體120的所述特定儲存區域122的第一個資料區塊接續寫入所述緩衝區域112內的所述運行日誌。換句話說,特定儲存區域122所包括的多個資料區塊是循環使用的。 In an optional implementation, the specific storage area 122 of the flash memory 120 includes a plurality of data blocks, and the size of each data block is the same as the size of the buffer area 112 (for example: 4KB, 4,000 byte), so that whenever the buffer area 112 is full, the first data block of the specific storage area 122 of the flash memory 120 starts to be written into the running log in the buffer area 112; When the last data block of the specific storage area 122 of the flash memory 120 is continuously written into the running log in the buffer area 112, the specific storage area 122 of the flash memory 120 is then The first data block is continuously written into the running log in the buffer area 112 . In other words, the plurality of data blocks included in the specific storage area 122 are used cyclically.

步驟S216:每隔一段預定時間將所述儲存區塊114更新至所述快閃記憶體120。由於所述儲存區塊114內的資料於斷電後即刻消失,為避免重新上電之後,出現運行日誌錯亂的問題,因此,處理器134每隔一段預定時間會將所述儲存區塊114更新至所述快閃記憶體120。 Step S216: Update the storage block 114 to the flash memory 120 at predetermined intervals. Since the data in the storage block 114 disappears immediately after the power is turned off, in order to avoid the problem of confusing running logs after the power is turned on again, the processor 134 updates the storage block 114 at predetermined intervals. to the flash memory 120 .

步驟S218:當所述儲存裝置100進入初始化階段時,啟動所述控制器130的看門狗電路140。 Step S218: When the storage device 100 enters the initialization phase, start the watchdog circuit 140 of the controller 130.

步驟S220:當所述看門狗電路140計數一預設計數時間過後且所述儲存裝置100未完成所述初始化階段時,將所述儲存裝置100設置成強制低階格式化模式,通過讀取所述快閃記憶體120的所述特定儲存區域122,進而獲取最新的所述運行日誌。 Step S220: When the watchdog circuit 140 counts a preset counting time and the storage device 100 has not completed the initialization phase, the storage device 100 is set to a forced low-level formatting mode, by reading The specific storage area 122 of the flash memory 120 is obtained, and the latest running log is obtained.

在一種可選的實施方式中,當所述看門狗電路140計數所述預設計數時間過後且所述儲存裝置100未完成所述初始化階段時,判斷所述儲存裝置100的快閃記憶體轉換層損壞。 In an optional implementation, when the watchdog circuit 140 counts the preset counting time and the storage device 100 has not completed the initialization phase, it is determined that the flash memory of the storage device 100 The conversion layer is damaged.

步驟S222:當所述儲存裝置100完成所述初始化階段時,關閉所述看門狗電路140。 Step S222: When the storage device 100 completes the initialization phase, turn off the watchdog circuit 140.

在一種可選的實施方式中,當所述儲存裝置100完成所述初始化階段時,關閉所述看門狗電路140,還可將更新於所述快閃記憶體120中最新的所述儲存區塊114複製於所述記憶體110,且根據所述記憶體110中複製的所述儲存區塊114所紀錄的所述偏移值獲取所述運行日誌下次寫入所述快閃記憶體120的所述特定儲存區域122的位置。 In an optional implementation, when the storage device 100 completes the initialization phase, the watchdog circuit 140 is turned off, and the latest storage area in the flash memory 120 can also be updated. Block 114 is copied to the memory 110, and the running log is obtained and written to the flash memory 120 next time according to the offset value recorded in the copied storage block 114 in the memory 110. The location of the specific storage area 122.

上述實施例中,由於僅通過緩衝區域112暫存運行日誌,因此,存在當處理器134將緩衝區域112所暫存的運行日誌寫入快閃記憶體120的特定儲存區域122時,緩衝區域112即無法暫存處理器134將運行日誌寫入快閃記憶體120的過程中所生成的運行日誌,造成部份運行日誌無法被儲存的問題。為了解決上述實施例所存在部份運行日誌無法被儲存記錄的問題,在一實施例中,可將緩衝區域112設計成包括第一緩衝子區域和第二緩衝子區域,並通過乒乓存取機制(Ping-pong Buffer)將第一緩衝子區域和第二緩衝子區域所接續暫存的運行日誌寫入所述快閃記憶體120的所述特定儲存區域122,詳細說明請參閱圖4,圖4為依據本發明的運行日誌的存取方法的另一實施例方法流程圖。 In the above embodiment, since the running log is only temporarily stored through the buffer area 112, there is a possibility that when the processor 134 writes the running log temporarily stored in the buffer area 112 into the specific storage area 122 of the flash memory 120, the buffer area 112 That is, the running log generated when the processor 134 writes the running log to the flash memory 120 cannot be temporarily stored, causing a problem that some running logs cannot be stored. In order to solve the problem that some running logs cannot be stored and recorded in the above embodiment, in one embodiment, the buffer area 112 can be designed to include a first buffer sub-area and a second buffer sub-area, and access through a ping-pong mechanism. (Ping-pong Buffer) Write the temporarily stored running logs connected to the first buffer sub-area and the second buffer sub-area into the specific storage area 122 of the flash memory 120. For details, please refer to Figure 4. 4 is a method flow chart of another embodiment of the running log access method according to the present invention.

步驟S412:接續暫存所述運行日誌於所述第一緩衝子區域和所述第二緩衝子區域。 Step S412: Continue to temporarily store the running log in the first buffer sub-area and the second buffer sub-area.

步驟S414:利用乒乓存取機制將所述第一緩衝子區域和所述第二緩衝子區域所填滿的所述運行日誌接續寫入所述快閃記憶體120的所述特定儲存區域122,並於所述第一緩衝子區域或所述第二緩衝子區域所填滿的所述運行日誌接續寫入所述快閃記憶體120的所述特定儲存區域122後,修改所述記憶體110的所述儲存區塊114所紀錄的所述偏移值,且釋放所述記憶體110的所述第一緩衝子區域或所述第二緩衝子區域,以重新執行步驟S412。 Step S414: Use a ping-pong access mechanism to continuously write the running log filled in the first buffer sub-area and the second buffer sub-area into the specific storage area 122 of the flash memory 120, And after the running log filled in the first buffer sub-area or the second buffer sub-area is continuously written into the specific storage area 122 of the flash memory 120, the memory 110 is modified. The offset value recorded in the storage block 114 is obtained, and the first buffer sub-area or the second buffer sub-area of the memory 110 is released to re-execute step S412.

舉例而言,運行日誌可先暫存於第一緩衝子區域,待第一緩衝子區域已滿時,待第一緩衝子區域已滿時,則將運行日誌暫存於第二緩衝子區域,同時,將第一緩衝子區域所填滿的所述運行日誌寫入所述快閃記憶體120的所述特定儲存區域122,並於寫入完畢後釋放所述記憶體110的所述第一緩衝子區域,且修改所述記憶體110的所述儲存區塊114所紀錄的所述偏移值;等到第二緩衝子區域已滿時,則將運行日誌暫存於第一緩衝子區域(第一緩衝子區域會在第二緩衝子區域填滿運行日誌之前被釋放),同時將第二緩衝子區域所填滿的所述運行日誌寫入所述快閃記憶體120的所述特定儲存區域122,並於寫入完畢後釋放所述記憶體110的所述第二緩衝子區域,且修改所述記憶體110的所述儲存區塊114所紀錄的所述偏移值。 For example, the running log can be temporarily stored in the first buffer sub-area. When the first buffer sub-area is full, the running log can be temporarily stored in the second buffer sub-area. At the same time, the running log filled in the first buffer sub-area is written into the specific storage area 122 of the flash memory 120, and after the writing is completed, the first buffer area of the memory 110 is released. buffer sub-area, and modify the offset value recorded in the storage block 114 of the memory 110; when the second buffer sub-area is full, the running log is temporarily stored in the first buffer sub-area ( The first buffer sub-area will be released before the second buffer sub-area fills up the running log), and at the same time, the running log filled in the second buffer sub-area is written into the specific storage of the flash memory 120 area 122, and after the writing is completed, the second buffer sub-area of the memory 110 is released, and the offset value recorded in the storage block 114 of the memory 110 is modified.

步驟S416:每隔一段預定時間將所述儲存區塊114更新至所述快閃記憶體120。 Step S416: Update the storage block 114 to the flash memory 120 at predetermined intervals.

步驟S418:當所述儲存裝置100進入初始化階段時,啟動所述控制器130的看門狗電路140。 Step S418: When the storage device 100 enters the initialization phase, start the watchdog circuit 140 of the controller 130.

步驟S420:當所述看門狗電路140計數一預設計數時間過後且所述儲存裝置100未完成所述初始化階段時,將所述儲存裝置100設置成強制低階格式化模式,通過讀取所述快閃記憶體120的所述特定儲存區域122,進而獲取最新的所述運行日誌。 Step S420: When the watchdog circuit 140 counts a preset counting time and the storage device 100 has not completed the initialization phase, the storage device 100 is set to a forced low-level formatting mode, by reading The specific storage area 122 of the flash memory 120 is obtained, and the latest running log is obtained.

步驟S422:當所述儲存裝置100完成所述初始化階段時,關閉所述看門狗電路140。 Step S422: When the storage device 100 completes the initialization phase, turn off the watchdog circuit 140.

上述步驟S416至步驟S422和步驟S216至步驟S222相同,因此,於此不再贅述。 The above-mentioned steps S416 to step S422 are the same as steps S216 to step S222, and therefore will not be described again.

在一實施例中,處理器134執行上述步驟S212或步驟S412之前,所述處理器134還用於當所述儲存裝置100進行低階格式化(Low-Level Formatting,LLF)操作時,將所述記憶體110的所述儲存區塊114所記錄的所述偏移值設置為預設值,並將所述記憶體110的所述儲存區塊114複製至所述快閃記憶體120。因此,不會影響在此之前記錄的所述運行日誌,同時可以保證所述運行日誌的連續性。其中,預設值可為0,但本發明並不以此為限。 In one embodiment, before the processor 134 performs the above-mentioned step S212 or step S412, the processor 134 is also configured to perform a low-level formatting (LLF) operation when the storage device 100 performs a low-level formatting (LLF) operation. The offset value recorded in the storage block 114 of the memory 110 is set to a default value, and the storage block 114 of the memory 110 is copied to the flash memory 120 . Therefore, the previously recorded running logs will not be affected, and the continuity of the running logs can be ensured. The preset value may be 0, but the present invention is not limited to this.

在一實施例中,所述處理器134還用於當所述儲存裝置100斷電後重新通電啟動時,找到斷電前更新於所述快閃記憶體120中最新的所述儲存區塊114,並複製於所述記憶體110,進而根據所述記憶體110中複製的所述儲存區塊114所紀錄的所述偏移值獲取所述運行日誌下次寫入所述快閃記憶體120的所述特定儲存區域122的位置。 In one embodiment, the processor 134 is also configured to find the latest storage block 114 updated in the flash memory 120 before the power outage when the storage device 100 is powered on again. , and copied to the memory 110, and then according to the offset value recorded in the copied storage block 114 in the memory 110, the running log is obtained and written to the flash memory 120 next time. The location of the specific storage area 122.

綜上所述,本申請提供一種運行日誌的存取方法及儲存裝置,通過在儲存裝置運行過程中,將其運行日誌記錄在快閃記憶體的固定 位置(即特定儲存區域),使得運行日誌的紀錄不受檔案系統的影響;同時,使用看門狗電路運行在儲存裝置初始化階段,如果快閃記憶體轉換層有損壞時,看門狗電路會觸發處理器以將儲存裝置設置成強制低階格式化模式,直接讀取快閃記憶體的特定儲存區域,進而獲取最新的運行日誌,以此保證在不拆解儲存裝置的外殼的情況下,可以獲取運行日誌。因此,當儲存裝置發生不可預知的現象時,可以獲取運行日誌,並通過獲取的運行日誌分析原因。 To sum up, this application provides a method for accessing operation logs and a storage device. During the operation of the storage device, the operation logs are recorded in a fixed location of the flash memory. location (that is, a specific storage area) so that the records of the running log are not affected by the file system; at the same time, the watchdog circuit is used to run during the initialization phase of the storage device. If the flash memory conversion layer is damaged, the watchdog circuit will Trigger the processor to set the storage device into forced low-level formatting mode, directly read a specific storage area of the flash memory, and obtain the latest running log to ensure that the storage device can be stored without disassembling the casing of the storage device. Run logs can be obtained. Therefore, when an unpredictable phenomenon occurs in the storage device, the operation log can be obtained, and the cause can be analyzed through the obtained operation log.

本發明所述的方法中的全部或部分步驟可以電腦程式實現,例如電腦的作業系統、電腦中特定硬體的驅動程式、或軟體程式。此外,也可實現在如上所示的其他類型程式。所屬技術領域中具有通常知識者可將本發明實施例的方法撰寫成電腦程式,為求簡明不再加以描述。依據本發明實施例方法實施的電腦程式可儲存在適當的電腦可讀取介質,例如DVD、CD-ROM、USB、硬碟,亦可置於可通過網路(例如,互聯網,或其他適當載體)存取的網路伺服器。 All or part of the steps in the method of the present invention can be implemented by a computer program, such as a computer operating system, a driver for specific hardware in the computer, or a software program. In addition, other types of programs as shown above can also be implemented. A person with ordinary knowledge in the relevant technical field can write the method of the embodiment of the present invention into a computer program, which will not be described for the sake of simplicity. The computer program implemented according to the method of the embodiment of the present invention can be stored in an appropriate computer-readable medium, such as DVD, CD-ROM, USB, hard disk, or can be placed through a network (for example, the Internet, or other appropriate carriers). ) to access the web server.

雖然在本申請的圖式中包含了以上描述的組件,但不排除在不違反發明的精神下,使用更多其他的附加元件,已達成更佳的技術效果。此外,雖然本申請的流程圖採用指定的順序來執行,但是在不違反發明精神的情況下,所屬技術領域的技術人員可以在達到相同效果的前提下,修改這些步驟間的順序,所以,本發明並不局限於僅使用如上所述的順序。此外,所屬技術領域的技術人員也可以將若干步驟整合為一個步驟,或者是除了這些步驟外,循序或平行地執行更多步驟,本發明也不因此而局限。 Although the above-described components are included in the drawings of this application, it does not rule out the use of other additional components to achieve better technical effects without violating the spirit of the invention. In addition, although the flow chart of the present application is executed in a specified order, those skilled in the art can modify the order of these steps on the premise of achieving the same effect without violating the spirit of the invention. Therefore, the present application The invention is not limited to the use of only the sequence described above. In addition, those skilled in the art can also integrate several steps into one step, or in addition to these steps, perform more steps sequentially or in parallel, and the present invention is not limited thereby.

雖然本發明使用以上實施例進行說明,但需要注意的是,這些描述並非用於限縮本發明。相反地,此發明涵蓋了所屬技術領域中的技術人員顯而易見的修改與相似設置。所以,申請專利範圍須以最寬廣的方式解釋來包含所有顯而易見的修改與相似設置。 Although the present invention is described using the above embodiments, it should be noted that these descriptions are not intended to limit the present invention. On the contrary, the invention is intended to cover modifications and similar arrangements obvious to those skilled in the art. Therefore, the scope of the patent application must be interpreted in the broadest manner to include all obvious modifications and similar arrangements.

S212:步驟 S212: Step

S214:步驟 S214: Step

S216:步驟 S216: Step

S218:步驟 S218: Step

S220:步驟 S220: Steps

S222:步驟 S222: Step

Claims (9)

一種運行日誌的存取方法,應用於一儲存裝置,所述儲存裝置包括一目標記憶體、一快閃記憶體和一控制器,所述運行日誌的存取方法包括下列步驟:(a)設置所述目標記憶體的一緩衝區域且暫存所述儲存裝置的一運行日誌於所述目標記憶體的所述緩衝區域;(b)將所述緩衝區域內的所述運行日誌寫入所述快閃記憶體的一特定儲存區域,並於寫入完畢後修改所述目標記憶體的一儲存區塊所紀錄的一偏移值,且釋放所述目標記憶體的所述緩衝區域,以重新暫存所述儲存裝置的所述運行日誌,其中,所述偏移值對應於所述緩衝區域內的所述運行日誌寫入所述特定儲存區域的一位置;(c)每隔一段預定時間將所述儲存區塊更新至所述快閃記憶體;(d)當所述儲存裝置進入初始化階段時,啟動所述控制器的一看門狗電路;(e)當所述看門狗電路計數一預設計數時間過後且所述儲存裝置未完成所述初始化階段時,將所述儲存裝置設置成一強制低階格式化模式,通過讀取所述快閃記憶體的所述特定儲存區域,進而獲取最新的所述運行日誌;以及(f)當所述儲存裝置完成所述初始化階段時,關閉所述看門狗電路;當所述看門狗電路計數該預設計數時間過後且所述儲存裝置未完成所述初始化階段時,判斷所述儲存裝置的所述快閃記憶體一轉換層損壞。 A method of accessing a running log, applied to a storage device. The storage device includes a target memory, a flash memory and a controller. The method of accessing a running log includes the following steps: (a) setting A buffer area of the target memory and temporarily storing a running log of the storage device in the buffer area of the target memory; (b) writing the running log in the buffer area to the A specific storage area of the flash memory, and after the writing is completed, an offset value recorded in a storage block of the target memory is modified, and the buffer area of the target memory is released to re- Temporarily storing the running log of the storage device, wherein the offset value corresponds to a location where the running log in the buffer area is written into the specific storage area; (c) every predetermined period of time Update the storage block to the flash memory; (d) when the storage device enters the initialization phase, activate a watchdog circuit of the controller; (e) when the watchdog circuit After counting a preset counting time and the storage device has not completed the initialization phase, the storage device is set to a forced low-level format mode by reading the specific storage area of the flash memory. , and then obtain the latest running log; and (f) when the storage device completes the initialization phase, close the watchdog circuit; when the watchdog circuit counts the preset counting time and the When the storage device has not completed the initialization phase, it is determined that a conversion layer of the flash memory of the storage device is damaged. 如請求項1所述的運行日誌的存取方法,在步驟(a)之前,所述的運行日誌的存取方法還包括下列步驟:當所述儲存裝置進行一低階格式化操作時,將所述目標記憶體的所述儲存區塊所記錄的所述偏移值設置為一預設值,並將所述目標記憶體的所述儲存區塊複製於所述快閃記憶體。 As in the method for accessing the running log described in claim 1, before step (a), the method for accessing the running log further includes the following steps: when the storage device performs a low-level format operation, The offset value recorded in the storage block of the target memory is set to a preset value, and the storage block of the target memory is copied to the flash memory. 如請求項1所述的運行日誌的存取方法,所述步驟(f)還包括:將更新於所述快閃記憶體中最新的所述儲存區塊複製於所述目標記憶體,且根據所述目標記憶體中複製的所述儲存區塊所紀錄的所述偏移值獲取所述運行日誌下次寫入所述快閃記憶體的所述特定儲存區域的所述位置。 As for the method of accessing the running log according to claim 1, the step (f) further includes: copying the latest storage block updated in the flash memory to the target memory, and according to The offset value recorded in the copied storage block in the target memory obtains the location where the running log is written next to the specific storage area of the flash memory. 如請求項1所述的運行日誌的存取方法,還包括下列步驟:當所述儲存裝置斷電後重新上電啟動時,找到斷電前更新於所述快閃記憶體中最新的所述儲存區塊,並複製於所述目標記憶體,進而根據所述目標記憶體中複製的所述儲存區塊所紀錄的所述偏移值獲取所述運行日誌下次寫入所述快閃記憶體的所述特定儲存區域的所述位置。 The method for accessing the running log as described in claim 1 further includes the following steps: when the storage device is powered on again after a power outage, find the latest update in the flash memory before the power outage. Store the block and copy it to the target memory, and then obtain the running log and write it to the flash memory next time based on the offset value recorded in the copied storage block in the target memory. the location of the specific storage area of the body. 如請求項1所述的運行日誌的存取方法,步驟(b)還包括:每當所述緩衝區域已滿時,將所述緩衝區域內的所述運行日誌寫入所述快閃記憶體的所述特定儲存區域,並於寫入完畢後修改所述目標記憶體的所述儲存區塊所紀錄的所述偏移值,且釋放所述目標記憶體的所述緩衝區域。 The method for accessing the running log as described in claim 1, step (b) further includes: writing the running log in the buffer area to the flash memory every time the buffer area is full. The specific storage area, and after the writing is completed, the offset value recorded in the storage block of the target memory is modified, and the buffer area of the target memory is released. 一種儲存裝置,包括一控制器、一目標記憶體和一快閃記憶體,所述目標記憶體和所述快閃記憶體分別與所述控制器連接,所述控制器包括:一非揮發性記憶體,用於儲存實現運行日誌的存取方法的程式碼;一處理器,耦接所述非揮發性記憶體,用於載入所述運行日誌的存取方法的程式碼,以執行下列步驟:(a)設置所述目標記憶體的一緩衝區域且暫存所述儲存裝置的一運行日誌於所述目標記憶體的所述緩衝區域;(b)將所述緩衝區域內的所述運行日誌寫入所述快閃記憶體的一特定儲存區域,並於寫入完畢後修改所述目標記憶體的一儲存區塊所紀錄的一偏移值,且釋放所述目標記憶體的所述緩衝區域,以重新暫存所述儲存裝置的所述運行日誌,其中,所述偏移值對應於所述緩衝區域內的所述運行日誌寫入所述特定儲存區域的一位置;(c)每隔一段預定時間將所述儲存區塊更新至所述快閃記憶體;(d)當所述儲存裝置進入初始化階段時,啟動所述控制器的一看門狗電路;(e)當所述看門狗電路計數一預設計數時間過後且所述儲存裝置未完成所述初始化階段時,將所述儲存裝置設置成一強制低階格式化模式,通過讀取所述快閃記憶體的所述特定儲存區域,進而獲取最新的所述運行日誌;以及(f)當所述儲存裝置完成所述初始化階段時,關閉所述看門狗電路; 當所述看門狗電路計數該預設計數時間過後且所述儲存裝置未完成所述初始化階段時,所述處理器還用於判斷所述儲存裝置的所述快閃記憶體一轉換層損壞。 A storage device includes a controller, a target memory and a flash memory. The target memory and the flash memory are respectively connected to the controller. The controller includes: a non-volatile A memory is used to store the program code that implements the access method of the running log; a processor is coupled to the non-volatile memory and is used to load the program code of the access method of the running log to execute the following Steps: (a) Set a buffer area of the target memory and temporarily store a running log of the storage device in the buffer area of the target memory; (b) Transfer the data in the buffer area to The running log is written into a specific storage area of the flash memory, and after the writing is completed, an offset value recorded in a storage block of the target memory is modified, and all parts of the target memory are released. The buffer area is used to re-temporarily store the running log of the storage device, wherein the offset value corresponds to a location where the running log in the buffer area is written into the specific storage area; (c ) Update the storage block to the flash memory at predetermined intervals; (d) When the storage device enters the initialization phase, activate a watchdog circuit of the controller; (e) When the storage device enters the initialization phase, When the watchdog circuit counts a preset counting time and the storage device has not completed the initialization phase, the storage device is set to a forced low-level format mode by reading the flash memory. The specific storage area, and then obtain the latest operation log; and (f) when the storage device completes the initialization phase, close the watchdog circuit; When the watchdog circuit counts the preset counting time and the storage device has not completed the initialization phase, the processor is also configured to determine that a conversion layer of the flash memory of the storage device is damaged. . 如請求項6所述的儲存裝置,在所述步驟(f)中,所述處理器還用於將更新於所述快閃記憶體中最新的所述儲存區塊複製於所述目標記憶體,且根據所述目標記憶體中複製的所述儲存區塊所紀錄的所述偏移值獲取所述運行日誌下次寫入所述快閃記憶體的所述特定儲存區域的所述位置。 The storage device of claim 6, in step (f), the processor is further configured to copy the latest storage block updated in the flash memory to the target memory. , and obtain the location where the running log is written to the specific storage area of the flash memory next time according to the offset value recorded in the copied storage block in the target memory. 如請求項6所述的儲存裝置,當所述儲存裝置斷電後重新上電啟動時,所述處理器還用於找到斷電前更新於所述快閃記憶體中最新的所述儲存區塊,並複製於所述目標記憶體,進而根據所述目標記憶體中複製的所述儲存區塊所紀錄的所述偏移值獲取所述運行日誌下次寫入所述快閃記憶體的所述特定儲存區域的所述位置。 As for the storage device of claim 6, when the storage device is powered on again after a power outage, the processor is also used to find the latest storage area updated in the flash memory before the power outage. block and copy it to the target memory, and then obtain the next writing time of the running log to the flash memory based on the offset value recorded in the copied storage block in the target memory. The location of the specific storage area. 如請求項6所述的儲存裝置,每當所述緩衝區域已滿時,所述處理器還用於將所述緩衝區域內的所述運行日誌寫入所述快閃記憶體的所述特定儲存區域,並於寫入完畢後修改所述目標記憶體的所述儲存區塊所紀錄的所述偏移值,且釋放所述目標記憶體的所述緩衝區域。 According to the storage device of claim 6, whenever the buffer area is full, the processor is further configured to write the running log in the buffer area to the specific area of the flash memory. storage area, and after the writing is completed, modify the offset value recorded in the storage block of the target memory, and release the buffer area of the target memory.
TW109136047A 2020-10-16 2020-10-16 Storage device and accessing method for operation log thereof TWI811573B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW109136047A TWI811573B (en) 2020-10-16 2020-10-16 Storage device and accessing method for operation log thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW109136047A TWI811573B (en) 2020-10-16 2020-10-16 Storage device and accessing method for operation log thereof

Publications (2)

Publication Number Publication Date
TW202217804A TW202217804A (en) 2022-05-01
TWI811573B true TWI811573B (en) 2023-08-11

Family

ID=82558558

Family Applications (1)

Application Number Title Priority Date Filing Date
TW109136047A TWI811573B (en) 2020-10-16 2020-10-16 Storage device and accessing method for operation log thereof

Country Status (1)

Country Link
TW (1) TWI811573B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW392149B (en) * 1996-04-04 2000-06-01 Texas Instruments Inc Data synchronization method and circuit using a timeout counter
US20090254572A1 (en) * 2007-01-05 2009-10-08 Redlich Ron M Digital information infrastructure and method
CN103597443A (en) * 2011-11-14 2014-02-19 Lsi公司 Storage device firmware and manufacturing software
US20150134926A1 (en) * 2013-11-08 2015-05-14 Fusion-Io, Inc. Systems and methods for log coordination
CN106970886A (en) * 2012-06-27 2017-07-21 英特尔公司 The physical link of the first agreement is controlled using the expanded function structure of second protocol

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW392149B (en) * 1996-04-04 2000-06-01 Texas Instruments Inc Data synchronization method and circuit using a timeout counter
US20090254572A1 (en) * 2007-01-05 2009-10-08 Redlich Ron M Digital information infrastructure and method
CN103597443A (en) * 2011-11-14 2014-02-19 Lsi公司 Storage device firmware and manufacturing software
CN106970886A (en) * 2012-06-27 2017-07-21 英特尔公司 The physical link of the first agreement is controlled using the expanded function structure of second protocol
US20150134926A1 (en) * 2013-11-08 2015-05-14 Fusion-Io, Inc. Systems and methods for log coordination

Also Published As

Publication number Publication date
TW202217804A (en) 2022-05-01

Similar Documents

Publication Publication Date Title
US10866797B2 (en) Data storage device and method for reducing firmware update time and data processing system including the device
US9928167B2 (en) Information processing system and nonvolatile storage unit
TWI515660B (en) Firmware variable update method
JP5554489B2 (en) Solid state memory (SSM), computer system having SSM, and SSM driving method
US20090327837A1 (en) NAND error management
US9864529B1 (en) Host compatibility for host managed storage media
US11036421B2 (en) Apparatus and method for retaining firmware in memory system
TW201619971A (en) Green nand SSD application and driver
US8266611B2 (en) Hard disk drive with disk embedded DOS boot image and firmware download method
KR102087495B1 (en) Changing storage parameters
US11755315B2 (en) Boot ROM update method and boot-up method of embedded system
US20130111103A1 (en) High-speed synchronous writes to persistent storage
US10521148B2 (en) Data storage device backup
WO2015023744A1 (en) Method and apparatus for performing annotated atomic write operations
TWI693518B (en) Data storage devices and methods for firmware failure prevention
TWI592866B (en) Methods for atomic writes in a ssd (solid state disk) system and apparatuses using the same
US10402101B2 (en) System and method for using persistent memory to accelerate write performance
JP2020191055A (en) Recovery processing method and device from instantaneous interruption, and computer readable storage medium
TWI811573B (en) Storage device and accessing method for operation log thereof
US11494112B2 (en) Storage device and accessing method for operation log thereof
TWI721365B (en) High efficiency garbage collection method, and associated data storage device and controller thereof
KR20210022260A (en) Operating method of memory controller, memory controller, and storage device
TWI669610B (en) Data storage device and control method for non-volatile memory
TWI741296B (en) Method and apparatuse and computer program product for handling sudden power off recovery
TWI820473B (en) Method and apparatuse and computer program product for handling sudden power off recovery