[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

TWI821152B - Storage device, flash memory control and control method thereo - Google Patents

Storage device, flash memory control and control method thereo Download PDF

Info

Publication number
TWI821152B
TWI821152B TW112121856A TW112121856A TWI821152B TW I821152 B TWI821152 B TW I821152B TW 112121856 A TW112121856 A TW 112121856A TW 112121856 A TW112121856 A TW 112121856A TW I821152 B TWI821152 B TW I821152B
Authority
TW
Taiwan
Prior art keywords
data
flash memory
block
area
blocks
Prior art date
Application number
TW112121856A
Other languages
Chinese (zh)
Other versions
TW202340964A (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 TW112121856A priority Critical patent/TWI821152B/en
Publication of TW202340964A publication Critical patent/TW202340964A/en
Application granted granted Critical
Publication of TWI821152B publication Critical patent/TWI821152B/en

Links

Landscapes

  • Read Only Memory (AREA)
  • Credit Cards Or The Like (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The present invention provides a control method of a flash memory controller, wherein the flash memory controller is configured to access a flash memory module, and the control method comprises the steps of: receiving a settling command from a host device to configure a portion space of the flash memory module as a zoned namespace; and determining quantity of blocks within each block according to a size of each zone and a size of each block within the flash memory module.

Description

儲存裝置、快閃記憶體控制器及其控制方法Storage device, flash memory controller and control method thereof

本發明係有關於快閃記憶體。The present invention relates to flash memory.

在非揮發性記憶體儲存裝置(Non-Volatile Memory express,NVMe)規範中,規範了一個區域命名空間(zoned namespace),然而,由於上述區域命名空間以及其中的每一個區域是單純以主裝置的角度來看的,因此,主裝置所定義出的每一個區域的大小與儲存裝置中快閃記憶體模組內每一個區塊(block)的大小並不具有固定的關係,因此,當主裝置準備將對應到一個區域的資料寫入至快閃記憶體模組時,快閃記憶體控制器會需要建立大量的邏輯位址與實體位址的映射表,例如以資料頁(page)為單位來記錄邏輯位址與實體位址的映射關係,因而造成快閃記憶體控制器在進行資料處理上的負擔,且也占用了靜態隨機存取記憶體(Static Random Access Memory,SRAM)及/或動態隨機存取記憶體(Dynamic Random Access Memory,DRAM)的儲存空間。In the Non-Volatile Memory Express (NVMe) specification, a zoned namespace is standardized. However, since the above zoned namespace and each zone in it are purely based on the master device, From a perspective, therefore, the size of each area defined by the main device does not have a fixed relationship with the size of each block in the flash memory module of the storage device. Therefore, when the main device When preparing to write data corresponding to an area to the flash memory module, the flash memory controller will need to create a large number of mapping tables between logical addresses and physical addresses, for example, in data pages (pages). To record the mapping relationship between logical addresses and physical addresses, thus causing a burden on the flash memory controller in data processing, and also occupying Static Random Access Memory (Static Random Access Memory, SRAM) and/or The storage space of Dynamic Random Access Memory (DRAM).

因此,本發明的目的之一在於提出一種快閃記憶體控制器,其可以有效率地管理由主裝置所寫入至快閃記憶體模組內之區域命名空間的資料,且所建立的邏輯位址與實體位址映射表具有較小的尺寸,以解決先前技術中所述的問題。Therefore, one of the objectives of the present invention is to provide a flash memory controller that can efficiently manage the data written by the host device to the regional namespace in the flash memory module, and the established logic The address to physical address mapping table has a smaller size to solve the problems described in the prior art.

在本發明的一個實施例中,揭露了一種應用於一快閃記憶體控制器的控制方法,其中該快閃記憶體控制器用以存取一快閃記憶體模組,該快閃記憶體模組包含了多個資料面,每一個資料面包含了多個區塊,且每一個區塊包含了多個資料頁,以及該控制方法包含有:接收來自一主裝置的設定指令,其中該設定指令係將快閃記憶體模組的至少一部份設定為一區域命名空間,其中該區域命名空間係邏輯性地包含多個區域,該主裝置對於該區域命名空間的資料寫入存取必須要以區域為單位來進行,每一個區域的大小都是相同的,每一個區域內所對應到的邏輯位址必須要是連續的,且區域之間不會有重疊的邏輯位址;對該區域命名空間進行組態以規劃出多個第一超級區塊,其中每一個第一超級區塊包含了分別位於至少兩個資料面內的多個區塊,且每一個第一超級區塊所包含之區塊的數量是根據每一個區域的大小以及每一個區塊的大小所決定的;接收來自該主裝置之對應至一特定區域的資料,其中該資料為該特定區域的所有資料;根據該資料之邏輯位址的順序,以依序將該資料寫入至該快閃記憶體模組之該多個第一超級區塊中的一特定第一超級區塊中;以及當該資料完成寫入之後,將該特定第一超級區塊所包含之最後一個區塊的剩餘資料頁寫入無效資料、或是將剩餘資料頁維持空白而且在抹除前不依據該主裝置的寫入指令寫入來自該主裝置的資料。In one embodiment of the present invention, a control method applied to a flash memory controller is disclosed, wherein the flash memory controller is used to access a flash memory module, and the flash memory module The group includes multiple data planes, each data plane includes multiple blocks, and each block includes multiple data pages, and the control method includes: receiving a setting command from a master device, wherein the setting The instruction is to set at least a part of the flash memory module as a region namespace, wherein the region namespace logically includes multiple regions, and the master device must write and access data in the region namespace. It must be done in units of areas. The size of each area is the same. The logical addresses corresponding to each area must be continuous, and there will be no overlapping logical addresses between areas. For this area The namespace is configured to plan a plurality of first super blocks, where each first super block includes a plurality of blocks located in at least two data planes, and each first super block includes The number of blocks is determined based on the size of each area and the size of each block; receiving data corresponding to a specific area from the main device, where the data is all data in the specific area; according to the The sequence of the logical addresses of the data is used to sequentially write the data into a specific first super block among the plurality of first super blocks of the flash memory module; and when the data is completed writing After entering, write invalid data to the remaining data pages of the last block included in the specific first super block, or keep the remaining data pages blank and do not write according to the write command of the master device before erasing. Import data from this master device.

在本發明的另一個實施例中,揭露了一種快閃記憶體控制器,其中該快閃記憶體控制器係用來存取一快閃記憶體模組,該快閃記憶體模組包含了多個資料面,每一個資料面包含了多個區塊,且每一個區塊包含了多個資料頁,且該快閃記憶體控制器包含有:一唯讀記憶體,用來儲存一程式碼;一微處理器,用來執行該程式碼以控制對該快閃記憶體模組之存取;以及一緩衝記憶體。該微處理器接收來自一主裝置的設定指令,其中該設定指令係將快閃記憶體模組的至少一部份設定為一區域命名空間,其中該區域命名空間係邏輯性地包含多個區域,該主裝置對於該區域命名空間的資料寫入存取必須要以區域為單位來進行,每一個區域的大小都是相同的,每一個區域內所對應到的邏輯位址必須要是連續的,且區域之間不會有重疊的邏輯位址;其中該微處理器對該區域命名空間進行組態以規劃出多個第一超級區塊,其中每一個第一超級區塊包含了分別位於至少兩個資料面內的多個區塊,且每一個第一超級區塊所包含之區塊的數量是根據每一個區域的大小以及每一個區塊的大小所決定的;該微處理器接收來自該主裝置之對應至一特定區域的資料,其中該資料為該特定區域的所有資料,且該微處理器根據該資料之邏輯位址的順序,以依序將該資料寫入至該快閃記憶體模組之該多個第一超級區塊中的一特定第一超級區塊中;以及當該資料完成寫入之後,該微處理器將該特定第一超級區塊所包含之最後一個區塊的剩餘資料頁寫入無效資料、或是將剩餘資料頁維持空白而且在抹除前不依據該主裝置的寫入指令寫入來自該主裝置的資料。In another embodiment of the present invention, a flash memory controller is disclosed, wherein the flash memory controller is used to access a flash memory module, and the flash memory module includes Multiple data planes, each data plane includes multiple blocks, and each block includes multiple data pages, and the flash memory controller includes: a read-only memory used to store a program code; a microprocessor for executing the code to control access to the flash memory module; and a buffer memory. The microprocessor receives a setting command from a host device, wherein the setting command sets at least a portion of the flash memory module as a region namespace, wherein the region namespace logically includes a plurality of regions. , the master device must write and access data in the area namespace in units of areas. The size of each area is the same, and the logical addresses corresponding to each area must be continuous. And there will be no overlapping logical addresses between areas; the microprocessor configures the area namespace to plan a plurality of first super blocks, where each first super block contains at least Multiple blocks within the two data planes, and the number of blocks included in each first super block is determined based on the size of each area and the size of each block; the microprocessor receives The main device corresponds to data in a specific area, where the data is all the data in the specific area, and the microprocessor writes the data to the flash in sequence according to the order of the logical addresses of the data. In a specific first super block among the plurality of first super blocks of the memory module; and after the data is completely written, the microprocessor writes the last one included in the specific first super block. Invalid data is written to the remaining data pages of the block, or the remaining data pages are kept blank and data from the master device is not written according to the write command of the master device before erasing.

在本發明的另一個實施例中,揭露了一種儲存裝置,其包含有一快閃記憶體模組以及一快閃記憶體控制器,其中該快閃記憶體模組包含了多個資料面,每一個資料面包含了多個區塊,且每一個區塊包含了多個資料頁,且該快閃記憶體控制器用以存取該快閃記憶體模組。該快閃記憶體控制器接收來自一主裝置的設定指令,其中該設定指令係將快閃記憶體模組的至少一部份設定為一區域命名空間,其中該區域命名空間係邏輯性地包含多個區域,該主裝置對於該區域命名空間的資料寫入存取必須要以區域為單位來進行,每一個區域的大小都是相同的,每一個區域內所對應到的邏輯位址必須要是連續的,且區域之間不會有重疊的邏輯位址;其中該快閃記憶體控制器對該區域命名空間進行組態以規劃出多個第一超級區塊,其中每一個第一超級區塊包含了分別位於至少兩個資料面內的多個區塊,且每一個第一超級區塊所包含之區塊的數量是根據每一個區域的大小以及每一個區塊的大小所決定的;該快閃記憶體控制器接收來自該主裝置之對應至一特定區域的資料,其中該資料為該特定區域的所有資料,且該快閃記憶體控制器根據該資料之邏輯位址的順序,以依序將該資料寫入至該快閃記憶體模組之該多個第一超級區塊中的一特定第一超級區塊中;以及當該資料完成寫入之後,該快閃記憶體控制器將該特定第一超級區塊所包含之最後一個區塊的剩餘資料頁寫入無效資料、或是將剩餘資料頁維持空白而且在抹除前不依據該主裝置的寫入指令寫入來自該主裝置的資料。In another embodiment of the present invention, a storage device is disclosed, which includes a flash memory module and a flash memory controller, wherein the flash memory module includes a plurality of data planes, each A data plane includes multiple blocks, and each block includes multiple data pages, and the flash memory controller is used to access the flash memory module. The flash memory controller receives a setting command from a host device, wherein the setting command sets at least a portion of the flash memory module as a region namespace, wherein the region namespace logically includes For multiple areas, the master device must write and access data in the area namespace in units of areas. The size of each area is the same, and the logical address corresponding to each area must be Continuous, and there will be no overlapping logical addresses between regions; wherein the flash memory controller configures the region namespace to plan a plurality of first super blocks, each of which is A block includes multiple blocks located in at least two data planes, and the number of blocks included in each first super block is determined based on the size of each area and the size of each block; The flash memory controller receives data corresponding to a specific area from the host device, where the data is all data in the specific area, and the flash memory controller is based on the order of logical addresses of the data, to sequentially write the data into a specific first super block among the plurality of first super blocks of the flash memory module; and after the writing of the data is completed, the flash memory The controller writes invalid data to the remaining data pages of the last block included in the specific first super block, or keeps the remaining data pages blank and does not write according to the write command of the host device before erasing. Data from this master device.

第1圖為根據本發明一實施例之電子裝置100的示意圖。如第1圖所示,電子裝置包含了一主裝置110及多個儲存裝置120_1~120_N,其中每一個儲存裝置,以儲存裝置120_1為例,包含了一快閃記憶體控制器122以及一快閃記憶體模組124。在本實施例中,多個儲存裝置120_1~120_N中的每一者可以是固態硬碟(solid-state drive, SSD)或是任何具有快閃記憶體模組的儲存裝置,主裝置可以是一中央處理器或是其他可以用來存取儲存裝置120_1~120_N的電子裝置或元件,且電子裝置100本身可以是一伺服器、個人電腦、筆記型電腦或是任何的可攜式電子裝置。需注意的是,雖然第1圖繪出了多個儲存裝置120_1~120_N,但在一實施例中,電子裝置100可以僅具有單一個儲存裝置120_1。Figure 1 is a schematic diagram of an electronic device 100 according to an embodiment of the present invention. As shown in Figure 1, the electronic device includes a main device 110 and a plurality of storage devices 120_1~120_N. Each storage device, taking the storage device 120_1 as an example, includes a flash memory controller 122 and a flash memory controller 122. Flash memory module 124. In this embodiment, each of the plurality of storage devices 120_1 ~ 120_N can be a solid-state drive (SSD) or any storage device with a flash memory module, and the main device can be a The central processing unit or other electronic devices or components can be used to access the storage devices 120_1~120_N, and the electronic device 100 itself can be a server, a personal computer, a notebook computer or any portable electronic device. It should be noted that although Figure 1 depicts multiple storage devices 120_1~120_N, in an embodiment, the electronic device 100 may only have a single storage device 120_1.

第2A圖為依據本發明一實施例之儲存裝置120_1內的快閃記憶體控制器122的示意圖。如第2A圖所示,快閃記憶體控制器122包含一微處理器212、一唯讀記憶體(Read Only Memory, ROM)212M、一控制邏輯214、一緩衝記憶體216與一介面邏輯218。唯讀記憶體212M係用來儲存一程式碼212C,而微處理器212則用來執行程式碼212C以控制對快閃記憶體模組124之存取(Access)。控制邏輯214包含了一編碼器232以及一解碼器234,其中編碼器232用來對寫入到快閃記憶體模組220中的資料進行編碼以產生對應的校驗碼(或稱,錯誤更正碼(Error Correction Code),ECC),而解碼器234用來將從快閃記憶體模組124所讀出的資料進行解碼。Figure 2A is a schematic diagram of the flash memory controller 122 in the storage device 120_1 according to an embodiment of the present invention. As shown in Figure 2A, the flash memory controller 122 includes a microprocessor 212, a read only memory (Read Only Memory, ROM) 212M, a control logic 214, a buffer memory 216 and an interface logic 218. . The read-only memory 212M is used to store a program code 212C, and the microprocessor 212 is used to execute the program code 212C to control access to the flash memory module 124. The control logic 214 includes an encoder 232 and a decoder 234. The encoder 232 is used to encode the data written into the flash memory module 220 to generate a corresponding check code (or error correction code). (Error Correction Code, ECC), and the decoder 234 is used to decode the data read from the flash memory module 124 .

於典型狀況下,快閃記憶體模組124包含了多個快閃記憶體晶片,而每一個快閃記憶體晶片包含複數個區塊(block),而快閃記憶體控制器122對快閃記憶體模組124進行抹除資料運作係以區塊為單位來進行。另外,一區塊可記錄特定數量的資料頁(page),其中快閃記憶體控制器122對快閃記憶體模組124進行寫入資料之運作係以資料頁為單位來進行寫入。在本實施例中,快閃記憶體模組124為一立體NAND型快閃記憶體(3D NAND-type flash)模組。In a typical situation, the flash memory module 124 includes multiple flash memory chips, and each flash memory chip includes a plurality of blocks, and the flash memory controller 122 controls the flash memory. The memory module 124 performs the data erasing operation on a block basis. In addition, a block can record a specific number of data pages (pages), and the flash memory controller 122 writes data to the flash memory module 124 in units of data pages. In this embodiment, the flash memory module 124 is a 3D NAND-type flash module.

實作上,透過微處理器212執行程式碼212C之快閃記憶體控制器210可利用其本身內部之元件來進行諸多控制運作,例如:利用控制邏輯214來控制快閃記憶體模組124之存取運作(尤其是對至少一區塊或至少一資料頁之存取運作)、利用緩衝記憶體216進行所需之緩衝處理、以及利用介面邏輯218來與主裝置110溝通。緩衝記憶體216係以隨機存取記憶體(Random Access Memory,RAM)來實施。例如,緩衝記憶體216可以是SRAM,但本發明不限於此。此外,快閃記憶體控制器122耦接於一DRAM 240。請注意到,DRAM 240亦可包含於快閃記憶體控制器122之內,例如與快閃記憶體控制器122存在於相同之封裝之中。In practice, the flash memory controller 210 that executes the program code 212C through the microprocessor 212 can use its own internal components to perform many control operations, such as using the control logic 214 to control the flash memory module 124 Access operations (especially access operations to at least one block or at least one data page), use the buffer memory 216 to perform required buffering processing, and use the interface logic 218 to communicate with the host device 110 . The buffer memory 216 is implemented as random access memory (Random Access Memory, RAM). For example, the buffer memory 216 may be SRAM, but the present invention is not limited thereto. In addition, the flash memory controller 122 is coupled to a DRAM 240 . Please note that the DRAM 240 may also be included within the flash memory controller 122 , for example, in the same package as the flash memory controller 122 .

在本實施例中,儲存裝置120_1係支援NVMe規範,亦即介面邏輯218可符合一特定通訊標準(例如外設組件互聯(Peripheral Component Interconnect,PCI)標準或PCIe標準),並且可依據該特定通訊標準進行通訊,例如透過連接器來和主裝置110進行通訊。In this embodiment, the storage device 120_1 supports the NVMe standard, that is, the interface logic 218 can comply with a specific communication standard (such as the Peripheral Component Interconnect (PCI) standard or the PCIe standard), and can be based on the specific communication standard. Communicate with the host device 110 through a standard, such as a connector.

第2B圖為依據本發明一實施例之快閃記憶體模組124中一區塊200的示意圖,其中快閃記憶體模組124為立體NAND型快閃記憶體。如第2B圖所示,區塊200包含了多個記憶單元(例如圖示的浮閘電晶體202或是其他的電荷捕捉(charge trap)元件),其透過多條位元線(圖示僅繪示了BL1~BL3)及多條字元線(例如圖示WL0~WL2、WL4~WL6)來構成立體NAND型快閃記憶體架構。在第2B圖中,以最上面的一個平面為例,字元線WL0上的所有浮閘電晶體構成了至少一資料頁,字元線WL1上的所有浮閘電晶體構成了另至少一資料頁,而字元線WL2的所有浮閘電晶體構成了再另至少一資料頁…以此類堆。此外,根據快閃記憶體寫入方式的不同,字元線WL0與資料頁(邏輯資料頁)之間的定義也會有所不同,詳細來說,當使用單層式儲存(Single-Level Cell,SLC)的方式寫入時,字元線WL0上的所有浮閘電晶體僅對應到單一邏輯資料頁;當使用雙層式儲存(Multi-Level Cell,MLC)的方式寫入時,字元線WL0上的所有浮閘電晶體對應到兩個邏輯資料頁;當使用三層式儲存(TLC)的方式寫入時,字元線WL0上的所有浮閘電晶體對應到三個邏輯資料頁;以及當使用四層式儲存(QLC)的方式寫入時,字元線WL0上的所有浮閘電晶體對應到四個邏輯資料頁。由於本技術領域中具有通常知識者應能了解立體NAND型快閃記憶體的結構以及字元線及資料頁之間的關係,故相關的細節在此不予贅述。Figure 2B is a schematic diagram of a block 200 in the flash memory module 124 according to an embodiment of the present invention, where the flash memory module 124 is a three-dimensional NAND flash memory. As shown in Figure 2B, the block 200 includes a plurality of memory cells (such as the floating gate transistor 202 shown in the figure or other charge trap elements), which pass through a plurality of bit lines (only the floating gate transistor 202 shown in the figure). BL1~BL3) and multiple word lines (such as WL0~WL2, WL4~WL6 shown in the figure) are shown to form a three-dimensional NAND flash memory architecture. In Figure 2B, taking the top plane as an example, all the floating gate transistors on the word line WL0 constitute at least one data page, and all the floating gate transistors on the word line WL1 constitute another at least one page of data. page, and all the floating gate transistors of word line WL2 constitute another at least one data page... and so on. In addition, depending on the flash memory writing method, the definition between word line WL0 and data page (logical data page) will also be different. Specifically, when using single-level storage (Single-Level Cell , SLC) method, all floating gate transistors on word line WL0 only correspond to a single logical data page; when writing using double-level storage (Multi-Level Cell, MLC) method, the character All floating gate transistors on line WL0 correspond to two logical data pages; when writing using three-level storage (TLC), all floating gate transistors on word line WL0 correspond to three logical data pages ; And when writing using the four-level storage (QLC) method, all floating gate transistors on the word line WL0 correspond to four logical data pages. Since those with ordinary knowledge in the art should be able to understand the structure of the three-dimensional NAND flash memory and the relationship between word lines and data pages, the relevant details will not be described again here.

在本實施例中,主裝置110係可以透過發送一個設定指令集,例如區域命名空間指令集(Zoned Namespaces Command Set),以將快閃記憶體模組124的至少一部份設定為區域命名空間(zoned namespace)。參考第3圖所示,主裝置110可以發送設定指令集至快閃記憶體控制器122,以使得快閃記憶體模組124具有至少一個區域命名空間(在本實施例中以區域命名空間310_1、310_2為例)以及至少一個一般儲存空間(在本實施例中以一般儲存空間320_1、320_2為例)。區域命名空間310_1在存取上會被劃分為多個區域(zone),而主裝置110對於區域命名空間310_1的資料寫入必須要以邏輯區塊位址(Logical block address,LBA)為單位來進行,一個邏輯區塊位址(或簡稱邏輯位址)可代表512位元組(512 bytes)的資料量,而主裝置110需對一個區域進行連續性的寫入。具體來說,參考第4圖,區域命名空間310_1係被劃分為多個區域(例如,Z0、Z1、Z2、Z3…等等),其中區域的大小係由主裝置110來設定,但每一個區域的大小都是相同的,每一個區域內所對應到的邏輯位址必須要是連續的,且區域之間不會有重疊的邏輯位址(亦即,一個邏輯位址只會存在於一個區域內)。舉例來說,假設每一個區域的大小為x個邏輯位址,而區域Z3的起始邏輯位址是LBA_k,則區域Z3則是用來儲存對應到邏輯位址LBA_k、LBA_(k+1)、LBA_(k+2)、LBA_(k+3)、…、LBA_(k+x-1)的資料。在一實施例中,相鄰區域的邏輯位址也是連續的,舉例來說,區域Z0係用來儲存具有邏輯位址LBA_1~LBA_2000的資料、區域Z1係用來儲存具有邏輯位址LBA_2001~LBA_4000的資料、區域Z2係用來儲存具有邏輯位址LBA_4001~LBA_6000的資料、區域Z3係用來儲存具有邏輯位址LBA_6001~LBA_8000的資料、…以此類推。此外,一個邏輯位址所對應的資料量大小可以由主裝置110所決定,例如,一個邏輯位址所對應的資料量大小可以是4千位元組(Kilobyte,KB)。In this embodiment, the host device 110 can set at least a part of the flash memory module 124 as a zoned namespace by sending a setting command set, such as a Zoned Namespaces Command Set. (zoned namespace). Referring to FIG. 3 , the host device 110 can send a setting instruction set to the flash memory controller 122 so that the flash memory module 124 has at least one region namespace (in this embodiment, the region namespace 310_1 , 310_2 as an example) and at least one general storage space (in this embodiment, general storage spaces 320_1 and 320_2 are taken as an example). The area namespace 310_1 will be divided into multiple zones (zones) for access, and the main device 110 must write data in the area namespace 310_1 in units of logical block addresses (LBA). To proceed, a logical block address (or simply logical address) can represent a data amount of 512 bytes, and the master device 110 needs to continuously write to an area. Specifically, referring to Figure 4, the area namespace 310_1 is divided into multiple areas (for example, Z0, Z1, Z2, Z3... etc.), the size of which is set by the main device 110, but each The sizes of the areas are all the same. The logical addresses corresponding to each area must be continuous, and there will be no overlapping logical addresses between areas (that is, a logical address will only exist in one area. within). For example, assume that the size of each area is x logical addresses, and the starting logical address of area Z3 is LBA_k, then area Z3 is used to store the data corresponding to logical addresses LBA_k, LBA_(k+1) , LBA_(k+2), LBA_(k+3),..., LBA_(k+x-1) information. In one embodiment, the logical addresses of adjacent areas are also consecutive. For example, area Z0 is used to store data with logical addresses LBA_1~LBA_2000, and area Z1 is used to store data with logical addresses LBA_2001~LBA_4000. Area Z2 is used to store data with logical addresses LBA_4001~LBA_6000, area Z3 is used to store data with logical addresses LBA_6001~LBA_8000, and so on. In addition, the data size corresponding to a logical address can be determined by the host device 110. For example, the data size corresponding to a logical address can be 4 kilobytes (KB).

此外,每一個區域的資料在進行寫入的時候,必須要按照邏輯位址的順序來進行。詳細來說,快閃記憶體控制器122會根據所寫入的資料來設定一個寫入指標(write point),以控制資料的寫入順序。詳細來說,假設區域Z1係用來儲存具有邏輯位址LBA_2001~LBA_4000的資料,而當主裝置110傳送對應到邏輯位址LBA_2001~LBA_2051的資料至快閃記憶體控制器122後,快閃記憶體控制器122會設定寫入指標為下一個邏輯位址LBA_2052。而若是後續主裝置110傳送屬於同一個區域的資料但不具有邏輯位址LBA_2052時,例如主裝置110傳送具有邏輯位址LBA_3000的資料,則快閃記憶體控制器122會拒絕這次的資料寫入並回傳寫入失敗的訊息給主裝置110;換句話說,只有當所接收到之資料的邏輯位址相同於寫入指標所指向的邏輯位址,快閃記憶體控制器122才會允許進行資料寫入。另外,若是多個區域的資料交替地進行寫入時,每一個區域可以有自己的寫入指標。In addition, when writing data in each area, it must be done in the order of logical addresses. Specifically, the flash memory controller 122 sets a write point (write point) according to the written data to control the writing sequence of the data. Specifically, it is assumed that area Z1 is used to store data with logical addresses LBA_2001~LBA_4000, and when the host device 110 transmits data corresponding to logical addresses LBA_2001~LBA_2051 to the flash memory controller 122, the flash memory The bank controller 122 will set the write pointer to the next logical address LBA_2052. If the master device 110 subsequently transmits data belonging to the same area but does not have the logical address LBA_2052, for example, the master device 110 transmits data with the logical address LBA_3000, the flash memory controller 122 will reject the data writing this time. and returns a write failure message to the host device 110; in other words, only when the logical address of the received data is the same as the logical address pointed to by the write pointer, the flash memory controller 122 will allow Write data. In addition, if data in multiple areas are written alternately, each area can have its own writing indicator.

如上所述,主裝置110會以區域為單位來與儲存裝置120_1進行溝通以對區域命名空間310_1進行存取,但由於上述區域命名空間310_1以及每一個區域是以主裝置110的角度來看的,因此,主裝置110所定義出的每一個區域的大小與儲存裝置120_1中快閃記憶體模組124內每一個實體區塊的大小並不具有固定的關係。具體來說,不同的快閃記憶體模組製造廠商所製造出來的快閃記憶體模組並不一樣,不同的記憶體模組具有不同大小的實體區塊,該些實體區塊的大小並不一定為整數倍,例如A型號的快閃記憶體模組的實體區塊大小可能為B型號的快閃記憶體模組的實體區塊的1.3倍大,而C型號的快閃記憶體模組的實體區塊大小可能為B型號的快閃記憶體模組的實體區塊的3.7倍大,如此一來,會導致主裝置110所設定的區域非常難與實體區塊齊致(align)。此時快閃記憶體控制器122在將邏輯區塊對應到實體區塊時將會面臨非常大的困難,例如可能造成儲存裝置120_1中有許多冗餘空間無法被使用者使用,或者,當主裝置110準備將對應到一個區域的資料寫入至快閃記憶體模組124時,會增加快閃記憶體控制器122在建立邏輯位址至實體位址(logical address to physical address,L2P)映射表上的複雜度。本發明在以下的實施例中提出了一種可以讓快閃記憶體控制器122有效率地根據主裝置110的存取指令來對區域命名空間310_1進行存取的方法。As mentioned above, the main device 110 will communicate with the storage device 120_1 in units of areas to access the area namespace 310_1. However, since the area namespace 310_1 and each area are viewed from the perspective of the main device 110 , therefore, the size of each area defined by the main device 110 does not have a fixed relationship with the size of each physical block in the flash memory module 124 in the storage device 120_1. Specifically, the flash memory modules produced by different flash memory module manufacturers are different. Different memory modules have physical blocks of different sizes, and the sizes of these physical blocks are not the same. It is not necessarily an integer multiple. For example, the physical block size of model A flash memory module may be 1.3 times larger than that of model B flash memory module, while the size of the physical block of model C flash memory module may be 1.3 times larger than that of model B flash memory module. The physical block size of the group may be 3.7 times larger than the physical block of the B-type flash memory module. As a result, it will be very difficult to align the area set by the main device 110 with the physical block. . At this time, the flash memory controller 122 will face great difficulties when mapping logical blocks to physical blocks. For example, it may cause a lot of redundant space in the storage device 120_1 that cannot be used by the user, or when the host When the device 110 is preparing to write data corresponding to a region to the flash memory module 124, the flash memory controller 122 is added to establish a logical address to physical address (L2P) mapping. complexity on the table. In the following embodiments, the present invention proposes a method that allows the flash memory controller 122 to efficiently access the area namespace 310_1 according to the access instructions of the host device 110 .

第5圖為根據本發明一實施例之將來自主裝置110的資料寫入至區域命名空間310_1的流程圖,其中本實施例係假設每一個區域所對應到的資料量係大於快閃記憶體模組124中每一個實體區塊的大小,且每一個區域所對應到的資料量並非是快閃記憶體模組124中每一個實體區塊之大小的整數倍。在步驟500中,流程開始,主裝置110及儲存裝置120_1上電並完成初始化操作,主裝置110對儲存裝置120_1中至少一部分儲存區域設定每個區域的大小、區域數量、邏輯區塊位址大小等基本設定,例如利用區域命名空間指令集(Zoned Namespaces Command Set)進行設定。在步驟502,主裝置110發送一寫入指令以及對應的資料至快閃記憶體控制器122,其中上述資料為對應到一或多個區域的資料,例如第4圖中區域Z3之對應到邏輯位址LBA_k~LBA_(k+x-1)的資料。在步驟504中,快閃記憶體控制器122自快閃記憶體模組124中選擇至少一個區塊(空白區塊、或稱備用區塊(spare block)),並依序將來自主裝置110的資料依序寫入至該至少一個區塊中。由於主裝置110所設定的區域大小非常難與實體區塊的大小齊致,所以當主裝置對區域Z3中所有的邏輯位址下達寫入指令後,主裝置110所欲寫入的資料通常仍無法填滿實體區塊的儲存空間,或者說,通常一個區域所對應的資料儲存量,通常不會是一個實體區塊中用來存放主裝置110所寫入資料的區域大小的整數倍。在步驟506中,當資料寫入至最後一個區塊並完成資料寫入後,快閃記憶體控制器122會將最後一個區塊的剩餘資料頁寫入無效資料(invalid data),或是直接將剩餘資料頁維持空白狀態,請注意到,每一個區塊通常都會保留若干資料頁用來存放系統管理資訊,例如用來存放寫入時間表、邏輯實體對應表、錯誤更正碼的檢查位元、磁碟陣列的同位元資料(RAID parity)等等管理所需的資料,此處所指的剩餘資料頁係指寫入該些系統管理資訊以及主裝置110所欲儲存的資料之後仍然有剩餘的資料頁。Figure 5 is a flow chart for writing data from the main device 110 to the region namespace 310_1 according to an embodiment of the present invention. This embodiment assumes that the amount of data corresponding to each region is larger than the flash memory model. The size of each physical block in the group 124, and the amount of data corresponding to each area is not an integer multiple of the size of each physical block in the flash memory module 124. In step 500, the process begins. The main device 110 and the storage device 120_1 are powered on and complete the initialization operation. The main device 110 sets the size of each area, the number of areas, and the logical block address size for at least part of the storage areas in the storage device 120_1. and other basic settings, such as using the Zoned Namespaces Command Set. In step 502, the host device 110 sends a write command and corresponding data to the flash memory controller 122, where the data is data corresponding to one or more areas, such as area Z3 in Figure 4 corresponding to the logic Data at addresses LBA_k~LBA_(k+x-1). In step 504, the flash memory controller 122 selects at least one block (blank block, or spare block) from the flash memory module 124, and sequentially receives the data from the main device 110. Data is written sequentially into the at least one block. Since the area size set by the main device 110 is very difficult to be consistent with the size of the physical block, when the main device issues write instructions to all logical addresses in area Z3, the data to be written by the main device 110 usually still remains. The storage space of the physical block cannot be filled, or in other words, the data storage amount corresponding to an area is usually not an integral multiple of the size of the area in a physical block used to store data written by the main device 110 . In step 506, when the data is written to the last block and the data writing is completed, the flash memory controller 122 writes invalid data to the remaining data pages of the last block, or directly Keep the remaining data pages blank. Please note that each block usually reserves several data pages to store system management information, such as writing schedules, logical entity correspondence tables, and error correction code check bits. , disk array parity data (RAID parity) and other data required for management. The remaining data page referred to here refers to the remaining data after writing the system management information and the data to be stored by the main device 110. Information page.

舉例來說,參考第6圖,假設每一個區域所對應到的資料量介於快閃記憶體模組124中兩個區塊至三個區塊之間,則快閃記憶體控制器122可以因應主裝置110針對區域Z1所發送的寫入命令,將區域Z1的資料依序寫入至區塊B3、B7以及B8中。請注意到,在一實施例中,主裝置110針對區域Z1所發送的寫入指令中包含了區域Z1的起始邏輯位址,而快閃記憶體控制器122係將區域Z1的起始邏輯位址對應到實體區塊B3的起始實體儲存空間,例如第一個實體資料頁,並且,快閃記憶體控制器122會將區域Z1的起始邏輯位址對應的資料存入實體區塊B3的起始實體儲存空間中,例如第一個實體資料頁。區塊B3、B7、B8均包含了資料頁P1~PM,而區域Z1的資料則根據邏輯位址依序地自區塊B3的第一個資料頁P1開始進行寫入至最後一個資料頁PM,而在區塊B3完成資料寫入之後,繼續由區塊B7的第一個資料頁P1開始進行寫入至最後一個資料頁PM。請注意到,即便主裝置110針對區域Z1內的邏輯位址連續地寫入,快閃記憶體控制器122仍可選擇不連續的區塊B3、B7來儲存該些邏輯上連續的資料。而在區塊B7完成資料寫入之後,繼續由區塊B8的第一個資料頁P1開始進行寫入直到區域Z1的資料結束;此外,區塊B8的剩餘資料頁會維持空白或是被寫入無效資料。類似地,快閃記憶體控制器122可以將區域Z3的資料依序寫入至區塊B12、B99以及B6中,其中區塊B12、B99以及B6均包含了資料頁P1~PM,而區域Z3的資料則根據邏輯位址依序地自區塊B12的第一個資料頁P1開始進行寫入至最後一個資料頁PM,而在區塊B12完成資料寫入之後,繼續由區塊B99的第一個資料頁P1開始進行寫入至最後一個資料頁PM,且在區塊B99完成資料寫入之後,繼續由區塊B6的第一個資料頁P1開始進行寫入直到區域Z3的資料結束;此外,區塊B6的剩餘資料頁會維持空白或是被寫入無效資料。請注意到,快閃記憶體控制器122可以不針對該些無效資料所在的實體資料頁建立邏輯頁與實體頁鏈結關係。而該些具有維持空白或是被寫入無效資料的實體資料頁的實體區塊,通常會被快閃記憶體控制器122對應到各區域的最後一部分,或者說快閃記憶體控制器122會將區域的最後一個邏輯位址所對應的資料儲存在一個具有空白頁或是寫入無效頁資料的實體區塊中。例如第7B圖(將於後詳述之)中所示,邏輯位址Z1_LBA+S+2*y會對應到實體區塊位址PBA8。而且若區域的最後一個邏輯位址的資料係儲存在一實體區塊的第X個儲存單位(例如實體儲存頁或是區段)中,則該實體區塊的第X+1個儲存單位會保留位空白頁或是寫入無效頁資料,亦即,空白頁或是寫入無效資料的資料頁係接續在對應區域的最後一個邏輯位址的資料所存放的實體儲存單位之後。而在另一個實施例中,主裝置110係定義了一個較大的區域大小(Zone Size),以及一個較小區域容量(Zone capacity),例如區域大小為512MB,區域容量為500MB,在此例中,快閃記憶體控制器122可以不將空白頁或是寫入無效資料的資料頁直接接續在對應區域的最後一個邏輯位址的資料所存放的實體儲存單位之後。For example, referring to FIG. 6 , assuming that the amount of data corresponding to each area is between two blocks and three blocks in the flash memory module 124 , the flash memory controller 122 can In response to the write command sent by the master device 110 for the area Z1, the data of the area Z1 is sequentially written into the blocks B3, B7 and B8. Please note that in one embodiment, the write command sent by the master device 110 for the area Z1 includes the starting logical address of the area Z1, and the flash memory controller 122 sets the starting logical address of the area Z1. The address corresponds to the starting physical storage space of the physical block B3, such as the first physical data page, and the flash memory controller 122 will store the data corresponding to the starting logical address of the area Z1 into the physical block. In the starting entity storage space of B3, such as the first entity data page. Blocks B3, B7, and B8 all include data pages P1~PM, and the data in area Z1 is written sequentially from the first data page P1 of block B3 to the last data page PM according to the logical address. , and after the data writing in block B3 is completed, writing continues from the first data page P1 of block B7 to the last data page PM. Please note that even if the master device 110 continuously writes to the logical addresses in the area Z1, the flash memory controller 122 can still select discontinuous blocks B3 and B7 to store the logically continuous data. After block B7 completes data writing, writing continues from the first data page P1 of block B8 until the end of the data in area Z1; in addition, the remaining data pages of block B8 will remain blank or be written. Invalid data entered. Similarly, the flash memory controller 122 can sequentially write the data of area Z3 into blocks B12, B99 and B6, where blocks B12, B99 and B6 all include data pages P1~PM, and area Z3 The data is written sequentially from the first data page P1 of block B12 to the last data page PM according to the logical address. After the completion of data writing in block B12, it continues from the first data page P1 of block B99. A data page P1 starts to be written to the last data page PM, and after the data writing is completed in block B99, writing continues from the first data page P1 of block B6 until the end of the data in area Z3; In addition, the remaining data pages of block B6 will remain blank or have invalid data written to them. Please note that the flash memory controller 122 may not establish a link relationship between the logical page and the physical page for the physical data page where the invalid data is located. The physical blocks with physical data pages that remain blank or have invalid data written to them are usually mapped to the last part of each area by the flash memory controller 122, or in other words, the flash memory controller 122 will Store the data corresponding to the last logical address of the area in a physical block with blank pages or written invalid page data. For example, as shown in Figure 7B (which will be described in detail later), the logical address Z1_LBA+S+2*y will correspond to the physical block address PBA8. And if the data of the last logical address of the area is stored in the Xth storage unit of a physical block (such as a physical storage page or section), then the X+1th storage unit of the physical block will Reserved bits are blank pages or invalid page data is written, that is, blank pages or data pages written with invalid data are continued after the physical storage unit where the data at the last logical address of the corresponding area is stored. In another embodiment, the main device 110 defines a larger zone size (Zone Size) and a smaller zone capacity (Zone capacity). For example, the zone size is 512MB and the zone capacity is 500MB. In this example , the flash memory controller 122 may not directly connect blank pages or data pages with invalid data written after the physical storage unit where the data at the last logical address of the corresponding area is stored.

在另一實施例中,主裝置110係針對區域Z1、Z2連續的邏輯位址發送寫入指令,而快閃記憶體控制器122選擇了區塊B3、B7、B8、B12、B99、B6用以儲存屬於區域Z1、Z2的資料。由於裝置110所設定的區域大小與實體區塊的大小並不齊致,主裝置110所欲寫入的資料仍無法填滿實體區塊的儲存空間,例如無法填滿實體區塊B8用來儲存主機資料的儲存空間,因此快閃記憶體控制器122仍舊要將實體區塊B8內該些儲存空間留白或是填入無效資料,所以儘管主裝置110針對區域Z1、Z2內連續的邏輯位址發送寫入指令,而且在實體區塊B8仍有空間儲存資料的狀況下,快閃記憶體控制器122仍舊不會將區域Z2的起始邏輯位址所對應的資料儲存在實體區塊B8之中,換言之,即便主裝置110發送了連續邏輯位址的寫入命令(例如包含了區域Z1的最後一個邏輯位址與區域Z2的第一個邏輯位址的寫入命令),且某一特定實體區塊(例如實體區塊B8)有足夠的空間儲存該些連續邏輯位址的資料,快閃記憶體控制器122仍舊不會將該些連續邏輯位址所對應的資料連續地儲存在該特定實體區塊中,而是跳躍性的將區域Z2的第一個邏輯位址所對應的資料寫入另一個實體區塊,例如區塊B20中。相應地,主裝置110若針對區域Z1、Z2內連續的邏輯位址發送讀取指令(例如包含了區域Z1的最後一個邏輯位址與區域Z2的第一個邏輯位址的讀取命令),快閃記憶體控制器122在讀取儲存在實體區塊P8中對應區域Z1的最後一個邏輯位址的資料之後,也會跳躍性地去讀取區塊B20的第一個儲存位置,以取得區域Z2的第一個邏輯位址的資料。In another embodiment, the master device 110 sends write commands to the consecutive logical addresses of areas Z1 and Z2, and the flash memory controller 122 selects blocks B3, B7, B8, B12, B99, and B6. To store data belonging to areas Z1 and Z2. Since the area size set by the device 110 is not consistent with the size of the physical block, the data to be written by the main device 110 still cannot fill the storage space of the physical block. For example, the physical block B8 cannot be filled for storage. The storage space of the host data, so the flash memory controller 122 still needs to leave the storage space in the physical block B8 blank or fill it with invalid data, so although the main device 110 targets the continuous logical bits in the areas Z1 and Z2 The flash memory controller 122 still does not store the data corresponding to the starting logical address of area Z2 in physical block B8 when the physical block B8 still has space to store data. In other words, even if the master device 110 sends write commands with consecutive logical addresses (for example, a write command including the last logical address of area Z1 and the first logical address of area Z2), and a certain A specific physical block (such as physical block B8) has enough space to store the data of the continuous logical addresses, and the flash memory controller 122 still does not continuously store the data corresponding to the continuous logical addresses in the In this specific physical block, the data corresponding to the first logical address of area Z2 is jumped and written into another physical block, such as block B20. Correspondingly, if the master device 110 sends a read command for consecutive logical addresses in areas Z1 and Z2 (for example, a read command including the last logical address of area Z1 and the first logical address of area Z2), After reading the data stored in the last logical address of the corresponding area Z1 in the physical block P8, the flash memory controller 122 will also jump to read the first storage location of the block B20 to obtain Data of the first logical address of area Z2.

在步驟508中,快閃記憶體控制器122建立或更新一L2P映射表以紀錄邏輯位址與實體位址的映射關係,以供後續自區域命名空間310_1進行資料讀取時使用。第7A圖為根據本發明一實施例之L2P映射表700的示意圖。L2P映射表700包含了兩個欄位,其中一個欄位紀錄了區域的起始邏輯位址、而另一個欄位則記錄了區塊的實體區塊位址。同時參考第6圖,由於區域Z1的資料依序寫入至區塊B3、B7及B8,且區域Z3的資料依序寫入至區塊B12、B99及B6,因此,L2P映射表700記錄了區域Z1的起始邏輯位址Z1_LBA_S及區塊B3、B7及B8的實體區塊位址PBA3、PBA7及PBA8,且記錄了區域Z3的起始邏輯位址Z3_LBA_S及區塊B12、B99及B6的實體區塊位址PBA12、PBA99及PBA6。舉例來說,假設區域Z1係用來儲存具有邏輯位址LBA_2001~LBA_4000的資料、區域Z3係用來儲存具有邏輯位址LBA_6001~LBA_8000的資料,則區域Z1的起始邏輯位址Z1_LBA_S即是LBA_2001,而區域Z3的起始邏輯位址Z3_LBA_S即是LBA_6001。請注意到,將來自主裝置110的資料寫入至區域命名空間310_1的流程圖中的各個步驟只要能達到相同的目的,不一定要依照固定的次序進行,例如步驟508可接在步驟502之後執行,熟悉此項技藝者在本發明的教導之下當可理解之。請注意到,在此實施例中,每個實體區塊均只對應到一個區域,例如區塊B3、B7及B8只對應到區域Z1,區塊B12、B99及B6只對應到區域Z3。或者說,單一區塊只儲存單一個區域的資料,例如區塊B3、B7及B8只儲存區域Z1所對應的資料,區塊B12、B99及B6只儲存區域Z3所對應的資料。In step 508, the flash memory controller 122 creates or updates an L2P mapping table to record the mapping relationship between logical addresses and physical addresses for subsequent use in reading data from the region namespace 310_1. Figure 7A is a schematic diagram of an L2P mapping table 700 according to an embodiment of the present invention. The L2P mapping table 700 includes two fields, one of which records the starting logical address of the area, and the other field records the physical block address of the block. Referring to Figure 6 at the same time, since the data of area Z1 is written to blocks B3, B7 and B8 in sequence, and the data of area Z3 is written to blocks B12, B99 and B6 in sequence, the L2P mapping table 700 records The starting logical address Z1_LBA_S of area Z1 and the physical block addresses PBA3, PBA7 and PBA8 of blocks B3, B7 and B8, and the starting logical address Z3_LBA_S of area Z3 and the blocks B12, B99 and B6 are recorded Physical block addresses PBA12, PBA99 and PBA6. For example, assuming that area Z1 is used to store data with logical addresses LBA_2001~LBA_4000, and area Z3 is used to store data with logical addresses LBA_6001~LBA_8000, then the starting logical address Z1_LBA_S of area Z1 is LBA_2001 , and the starting logical address Z3_LBA_S of area Z3 is LBA_6001. Please note that as long as the steps in the flow chart of writing data from the master device 110 to the region namespace 310_1 can achieve the same purpose, they do not have to be performed in a fixed order. For example, step 508 can be executed after step 502. , those familiar with this art should understand it under the teaching of the present invention. Please note that in this embodiment, each physical block only corresponds to one area. For example, blocks B3, B7, and B8 only correspond to area Z1, and blocks B12, B99, and B6 only correspond to area Z3. In other words, a single block only stores data in a single area. For example, blocks B3, B7, and B8 only store data corresponding to area Z1, and blocks B12, B99, and B6 only store data corresponding to area Z3.

除此之外,若主裝置110欲重置(reset)一個區域,例如重置區域Z1,快閃記憶體控制器122通常會修改L2P映射表700將與區域Z1相對應的實體區塊位址的欄位給刪除掉,例如刪除L2P映射表700中的實體區塊位址PBA3、PBA7及PBA8,代表主機已經不再需要該些實體區塊所儲存的資料。而快閃記憶體控制器122可稍後再將該些實體區塊給抹除,請注意到,實體區塊B8中儲存了主裝置110欲儲存的資料以及無效資料,雖然主裝置110所欲重置的區域Z1並不包含該些無效資料。為了管理上的方便,快閃記憶體控制器122在收到主裝置110針對區域Z1的重置指令後,仍會整體性地刪除L2P映射表700中的實體區塊位址PBA8,即便主裝置110所欲重置的區域Z1並不包含實體區塊B8中所儲存的該些無效資料。並且,快閃記憶體控制器122在抹除實體區塊B8之前,也不會將主裝置110發出的重置指令中所沒有包含到的無效資料給搬移到其他實體區塊去,而是將整個實體區塊直接刪除。In addition, if the host device 110 wants to reset an area, such as the area Z1, the flash memory controller 122 usually modifies the L2P mapping table 700 to set the physical block address corresponding to the area Z1. Delete the fields, for example, delete the physical block addresses PBA3, PBA7 and PBA8 in the L2P mapping table 700, which means that the host no longer needs the data stored in these physical blocks. The flash memory controller 122 can erase these physical blocks later. Please note that the physical block B8 stores the data that the main device 110 wants to store and the invalid data. Although the main device 110 wants to The reset area Z1 does not contain the invalid data. For management convenience, after receiving the reset command for area Z1 from the master device 110, the flash memory controller 122 will still delete the physical block address PBA8 in the L2P mapping table 700 as a whole, even if the master device 110 The area Z1 to be reset does not contain the invalid data stored in the physical block B8. Moreover, before erasing the physical block B8, the flash memory controller 122 will not move the invalid data not included in the reset command issued by the master device 110 to other physical blocks, but will The entire entity block is deleted directly.

在以上的實施例中,區域命名空間310_1內的任何一個實體區塊所儲存的資料都一定是屬於相同的區域,亦即,任何一個實體區塊內所儲存的所有資料的所對應的邏輯位址會屬於同一個區域。而且又因為主裝置110僅能對一個區域內的邏輯位址連續地寫入。因此,本實施例的L2P映射表700可以僅包含了區域命名空間310_1的實體區塊位址,而不會包含任何的資料頁位址,亦即L2P映射表700不會記錄任何區塊內的資料頁序號或相關的資料頁資訊。此外,L2P映射表700也僅會記錄每一個區域的起始邏輯位址,因此,L2P映射表700本身僅具有很小的資料量,故L2P映射表700可以常駐在緩衝記憶體216或是DRAM 240,而不會對緩衝記憶體216或DRAM 240的儲存空間造成太大的負擔。請注意到,由於主裝置110設定區域大小及區域個數之後,各個區域的起始邏輯位址就固定下來了,因此L2P映射表700可以更進一步的化簡為一個欄位,即,僅有實體區塊位址欄位。而區域的起始邏輯位址欄位即可利用表格的條目(entry)來代表,如第7B圖所示之L2P映射表710,而無需實際儲存多個區域的起始邏輯位址。In the above embodiment, the data stored in any physical block in the area namespace 310_1 must belong to the same area, that is, the corresponding logical bits of all the data stored in any one physical block addresses will belong to the same region. Moreover, the main device 110 can only write continuously to the logical addresses in one area. Therefore, the L2P mapping table 700 in this embodiment may only include the physical block address of the area namespace 310_1, and will not include any data page addresses. That is, the L2P mapping table 700 will not record any data in the block. Data page serial number or related data page information. In addition, the L2P mapping table 700 only records the starting logical address of each area. Therefore, the L2P mapping table 700 itself only has a small amount of data. Therefore, the L2P mapping table 700 can be resident in the buffer memory 216 or DRAM. 240 without causing too much burden on the storage space of the buffer memory 216 or the DRAM 240. Please note that since the main device 110 sets the area size and the number of areas, the starting logical address of each area is fixed, so the L2P mapping table 700 can be further simplified to one field, that is, only Entity block address field. The starting logical address field of the region can be represented by an entry in the table, such as the L2P mapping table 710 shown in Figure 7B, without actually storing the starting logical addresses of multiple regions.

在以上的實施例中,L2P映射表700中可以僅包含了區域命名空間310_1的實體區塊位址,而不會包含任何的資料頁位址,然而,在另一實施例中,L2P映射表700可以包含了每一個區域的起始邏輯位址及對應之實體區塊位址與第一個資料頁的實體資料頁位址。由於L2P映射表中的一個區域僅包含一個實體區塊位址及一個實體資料頁位址,故也只具有很小的資料量。In the above embodiment, the L2P mapping table 700 may only contain the physical block address of the area namespace 310_1, but not any data page address. However, in another embodiment, the L2P mapping table 700 may include the starting logical address of each area and the corresponding physical block address and the physical data page address of the first data page. Since an area in the L2P mapping table only contains one physical block address and one physical data page address, it only has a small amount of data.

第7C圖為根據本發明一實施例之L2P映射表720的示意圖。L2P映射表720包含了兩個欄位,其中一個欄位紀錄了邏輯位址、而另一個欄位則記錄了區塊的實體區塊位址。同時參考第6圖,由於區域Z1的資料依序寫入至區塊B3、B7及B8,且區域Z3的資料依序寫入至區塊B12、B99及B6,因此,L2P映射表720記錄了區域Z1的起始邏輯位址Z1_LBA_S及區塊B3的實體區塊位址PBA3、區域Z1的邏輯位址(Z1_LBA_S+y)及區塊B7的實體區塊位址PBA7、以及區域Z1的邏輯位址(Z1_LBA_S+2*y)及區塊B8的實體區塊位址PBA8,其中邏輯位址(Z1_LBA_S+y)可以是寫入至區塊B7之資料的第一個邏輯位址(亦即,對應到區塊B7之資料頁P1的邏輯位址),而邏輯位址(Z1_LBA_S+2*y)可以是寫入至區塊B8之資料的第一個邏輯位址(亦即,對應到區塊B8之資料頁P1的邏輯位址);類似地,L2P映射表720記錄了區域Z3的起始邏輯位址Z3_LBA_S及區塊B12的實體區塊位址PBA12、區域Z3的邏輯位址(Z3_LBA_S+y)及區塊B99的實體區塊位址PBA99、以及區域Z6的邏輯位址(Z3_LBA_S+2*y)及區塊B6的實體區塊位址PBA6,其中邏輯位址(Z3_LBA_S+y)可以是寫入至區塊B99之資料的第一個邏輯位址(亦即,對應到區塊B99之資料頁P1的邏輯位址),而邏輯位址(Z3_LBA_S+2*y)可以是寫入至區塊B6之資料的第一個邏輯位址(亦即,對應到區塊B6之資料頁P1的邏輯位址)。需注意的是,上述的“y”可以表示為一個區塊可以儲存多少筆邏輯位址的資料,尤其是指主裝置110傳送給儲存裝置120_1,希望儲存裝置120_1儲存的資料。請注意到,由於主裝置110設定區域大小及區域個數之後,各個區域的起始邏輯位址就固定下來了,各個子區域的起始邏輯位址也固定下來了,例如Z1_LBA_S、Z1_LBA_S+y、Z1_LBA_S+2*y、Z2_LBA_S、Z2_LBA_S+y、Z2_LBA_S+2*y……等,因此,類似的,L2P映射表720可以更進一步的化簡為一個欄位,即,僅有實體區塊位址欄位。而邏輯位址欄位即可利用表格的條目(entry)來代表,而無需實際儲存多個子區域的起始邏輯位址,例如第7D圖的L2P映射表740所示。Figure 7C is a schematic diagram of an L2P mapping table 720 according to an embodiment of the present invention. The L2P mapping table 720 includes two fields, one of which records the logical address, and the other field records the physical block address of the block. Referring to Figure 6 at the same time, since the data of area Z1 is written to blocks B3, B7 and B8 in sequence, and the data of area Z3 is written to blocks B12, B99 and B6 in order, the L2P mapping table 720 records The starting logical address Z1_LBA_S of area Z1 and the physical block address PBA3 of block B3, the logical address (Z1_LBA_S+y) of area Z1, the physical block address PBA7 of block B7, and the logical bit of area Z1 address (Z1_LBA_S+2*y) and the physical block address PBA8 of block B8, where the logical address (Z1_LBA_S+y) can be the first logical address of the data written to block B7 (i.e., corresponds to the logical address of the data page P1 of block B7), and the logical address (Z1_LBA_S+2*y) can be the first logical address of the data written to block B8 (that is, corresponding to the area The logical address of data page P1 of block B8); similarly, the L2P mapping table 720 records the starting logical address Z3_LBA_S of area Z3, the physical block address PBA12 of block B12, and the logical address (Z3_LBA_S) of area Z3. +y) and the physical block address PBA99 of block B99, and the logical address (Z3_LBA_S+2*y) of area Z6 and the physical block address PBA6 of block B6, where the logical address (Z3_LBA_S+y) It can be the first logical address of the data written to block B99 (that is, the logical address corresponding to the data page P1 of block B99), and the logical address (Z3_LBA_S+2*y) can be written The first logical address of the data entered into block B6 (that is, the logical address corresponding to the data page P1 of block B6). It should be noted that the above "y" can represent how many logical addresses of data can be stored in a block, especially the data that the main device 110 sends to the storage device 120_1 and hopes that the storage device 120_1 stores the data. Please note that after the main device 110 sets the area size and number of areas, the starting logical address of each area is fixed, and the starting logical address of each sub-area is also fixed, such as Z1_LBA_S, Z1_LBA_S+y , Z1_LBA_S+2*y, Z2_LBA_S, Z2_LBA_S+y, Z2_LBA_S+2*y... etc. Therefore, similarly, the L2P mapping table 720 can be further simplified to one field, that is, only the physical block position address field. The logical address field can be represented by an entry in the table without actually storing the starting logical addresses of multiple sub-regions, such as shown in the L2P mapping table 740 in Figure 7D.

需注意的是,本實施例的L2P映射表720僅包含了區域命名空間310_1的實體區塊位址,而不會包含任何的資料頁位址,亦即L2P映射表720不會記錄任何區塊內的資料頁序號或相關的資料頁資訊。此外,L2P映射表720也只會記錄每一個區塊所對應到的第一個邏輯位址,因此,L2P映射表720本身僅具有很小的資料量,故L2P映射表720可以常駐在緩衝記憶體216或是DRAM 240,而不會對緩衝記憶體216或DRAM 240的儲存空間造成太大的負擔。在一實施例中,上述L2P映射表720中所記錄的實體區塊位址可以另外搭配第一個資料頁的實體資料頁位址,而額外增加一個實體資料頁位址在實務上不會對儲存空間造成太大的負擔。It should be noted that the L2P mapping table 720 in this embodiment only contains the physical block address of the regional namespace 310_1, and does not include any data page addresses. That is, the L2P mapping table 720 does not record any blocks. The data page serial number or related data page information. In addition, the L2P mapping table 720 will only record the first logical address corresponding to each block. Therefore, the L2P mapping table 720 itself only has a small amount of data, so the L2P mapping table 720 can be resident in the buffer memory. memory 216 or DRAM 240 without causing too much burden on the storage space of the buffer memory 216 or DRAM 240. In one embodiment, the physical block address recorded in the above-mentioned L2P mapping table 720 can be additionally matched with the physical data page address of the first data page, and adding an additional physical data page address will not be practical. Storage space creates too much of a burden.

第8圖為根據本發明一實施例之自區域命名空間310_1讀取資料的流程圖,其中本實施例係假設區域命名空間310_1已經儲存了第6圖所示之區域Z1及Z3的資料。在步驟800中,流程開始,主裝置110及儲存裝置120_1上電並完成初始化操作(例如,開機程序)。在步驟802,主裝置110發送一讀入指令以要求讀取具有一特定邏輯位址的資料。在步驟804,快閃記憶體控制器122中的微處理器212判斷出該特定邏輯位址是屬於哪一個區域,並根據L2P映射表700或是L2P映射表720所記錄的邏輯位址來計算出該特定邏輯位址所對應的一實體資料頁位址。以第7A圖的L2P映射表700來做為說明,由於L2P映射表700記錄了個區域的起始邏輯位址,再加上每一個區域之邏輯位址的數量為已知,因此,微處理器212可以由上述資訊來得知該特定邏輯位址是屬於哪一個區域,以第6、7A圖的實施例來做說明,假設該特定邏輯位址為LBA_2500,一個區域包含了2000個邏輯位址,L2P映射表700記錄了區域Z1的起始邏輯位址Z1_LBA_S為LBA_2001,則微處理器212可以判斷出該特定邏輯位址屬於區域Z1。接著,微處理器212根據該特定邏輯位址與區域Z1的起始邏輯位址Z1_LBA_S之間的差距,再根據區塊之每一個資料頁所能夠儲存多少邏輯位址的資料,來決定出該特定邏輯位址所對應的該實體資料頁位址。為了方便說明,假設區塊中每一個資料頁只能儲存一個邏輯位址的資料,則該特定邏輯位址與區域Z1的起始邏輯位址Z1_LBA_S之間的差距為五百個邏輯位址,則微處理器212可以計算出該特定邏輯位址對應到區塊B3的第五百個資料頁P500的實體資料頁位址,而若是區塊B3的資料頁數量不足五百個,則由區塊B3的第一個資料頁P1開始數起第五百個資料頁以得到位於區塊B7的實體資料頁位址。Figure 8 is a flow chart of reading data from the area namespace 310_1 according to an embodiment of the present invention. This embodiment assumes that the area namespace 310_1 has already stored the data of the areas Z1 and Z3 shown in Figure 6. In step 800, the process starts. The main device 110 and the storage device 120_1 are powered on and complete the initialization operation (for example, the boot process). In step 802, the master device 110 sends a read command to request reading data with a specific logical address. In step 804, the microprocessor 212 in the flash memory controller 122 determines which area the specific logical address belongs to, and calculates the logical address according to the L2P mapping table 700 or the L2P mapping table 720. Obtain a physical data page address corresponding to the specific logical address. Take the L2P mapping table 700 in Figure 7A as an illustration. Since the L2P mapping table 700 records the starting logical address of each area, and the number of logical addresses in each area is known, the microprocessor The processor 212 can know which area the specific logical address belongs to based on the above information. Take the embodiments of Figures 6 and 7A for illustration. Assume that the specific logical address is LBA_2500, and one area contains 2000 logical addresses. , the L2P mapping table 700 records that the starting logical address Z1_LBA_S of the area Z1 is LBA_2001, then the microprocessor 212 can determine that the specific logical address belongs to the area Z1. Then, the microprocessor 212 determines the specific logical address based on the difference between the specific logical address and the starting logical address Z1_LBA_S of the area Z1, and based on how much data at the logical address can be stored in each data page of the block. The physical data page address corresponding to a specific logical address. For the convenience of explanation, assuming that each data page in the block can only store data at one logical address, the gap between this specific logical address and the starting logical address Z1_LBA_S of area Z1 is 500 logical addresses. Then the microprocessor 212 can calculate that the specific logical address corresponds to the physical data page address of the 500th data page P500 of block B3. If the number of data pages of block B3 is less than 500, then the physical data page address of block B3 is determined by the block B3. Count from the first data page P1 of block B3 to the 500th data page to obtain the address of the physical data page located in block B7.

另一方面,以第7B圖的L2P映射表720來做為說明,由於L2P映射表720記錄了個區域的多個邏輯位址,且這些邏輯位址分別對應到區塊B3、B7、B8的第一個資料頁P1,因此,微處理器212可以由上述資訊來得知該特定邏輯位址是屬於哪一個區域以及哪一個區塊。接著,微處理器212根據該特定邏輯位址與區域Z1的邏輯位址(例如,Z1_LBA_S、(Z1_LBA_S+y)或(Z1_LBA_S+2y))之間的差距,再根據區塊之每一個資料頁所能夠儲存多少邏輯位址的資料,來決定出該特定邏輯位址所對應的該實體資料頁位址。為了方便說明,假設區塊中每一個資料頁只能儲存一個邏輯位址的資料,則該特定邏輯位址與區域Z1的起始邏輯位址Z1_LBA_S之間的差距為五百個邏輯位址,則微處理器212可以計算出該特定邏輯位址對應到區塊B3的第五百個資料頁P500的實體資料頁位址。On the other hand, taking the L2P mapping table 720 in Figure 7B as an illustration, the L2P mapping table 720 records multiple logical addresses of an area, and these logical addresses correspond to blocks B3, B7, and B8 respectively. The first data page P1, therefore, the microprocessor 212 can know which area and which block the specific logical address belongs to based on the above information. Then, based on the difference between the specific logical address and the logical address of area Z1 (for example, Z1_LBA_S, (Z1_LBA_S+y) or (Z1_LBA_S+2y)), the microprocessor 212 then generates How much data can be stored at a logical address is determined by determining the address of the physical data page corresponding to the specific logical address. For the convenience of explanation, assuming that each data page in the block can only store data at one logical address, the gap between this specific logical address and the starting logical address Z1_LBA_S of area Z1 is 500 logical addresses. Then the microprocessor 212 can calculate that the specific logical address corresponds to the physical data page address of the 500th data page P500 of block B3.

在步驟806,微處理器212根據在步驟804中所決定出的實體區塊位址及實體資料頁位址,自區域命名空間310_1中讀取對應的資料,並將所讀取的資料回傳至主裝置110。In step 806, the microprocessor 212 reads the corresponding data from the area namespace 310_1 according to the physical block address and the physical data page address determined in step 804, and returns the read data. to the main device 110.

如上所述,透過以上實施例所述的內容,快閃記憶體控制器122可以在僅建立出很小尺寸之L2P映射表700/710/720/730的情形下,仍然可以有效地完成區域命名空間310_1的資料寫入及讀取。然而在此實施例中,會有許多實體區塊的剩餘資料頁被浪費掉,例如實體區塊B8、實體區塊B6中的空白或無效資料頁,該些剩餘資料頁將會大大的降低使用者可以使用到的記憶體空間,此種方法雖然可以降低快閃記憶體控制器122在管理上的負擔,但是卻會降低使用者可以使用到的記憶體空間,甚至在某些極端的案例中,因為剩餘資料頁的比例過高,還可能導致快閃記憶體控制器122無法規劃出足夠的記憶體空間供使用者使用。As mentioned above, through the contents described in the above embodiments, the flash memory controller 122 can still effectively complete the area naming while only establishing a small size L2P mapping table 700/710/720/730. Data writing and reading in space 310_1. However, in this embodiment, many remaining data pages of the physical blocks are wasted, such as blank or invalid data pages in the physical blocks B8 and B6. These remaining data pages will greatly reduce the usage. Although this method can reduce the management burden of the flash memory controller 122, it will also reduce the memory space available to the user, even in some extreme cases. , because the proportion of remaining data pages is too high, it may also cause the flash memory controller 122 to be unable to plan enough memory space for the user to use.

第9圖為根據本發明另一實施例之將來自主裝置110的資料寫入至區域命名空間310_1的流程圖,其中本實施例係假設每一個區域所對應到的資料量係大於快閃記憶體模組124中每一個區塊的大小,且每一個區域所對應到的資料量並非是快閃記憶體模組124中每一個區塊之大小的整數倍。在步驟900中,流程開始,主裝置110及儲存裝置120_1上電並完成初始化操作,主裝置110對儲存裝置120_1設定每個區域的大小、區域數量、邏輯區塊位址大小等基本設定,例如利用區域命名空間指令集(Zoned Namespaces Command Set)進行設定。在步驟902,主裝置110發送一寫入指令以及對應的資料至快閃記憶體控制器122,其中上述資料為對應到一或多個區域的資料,例如第4圖中區域Z3對應到邏輯位址LBA_k~LBA_(k+x-1)的資料。在步驟904中,快閃記憶體控制器122自快閃記憶體模組124中選擇至少一個區塊(空白區塊、或稱備用區塊)、或是選擇至少一個空白區塊或至少一共用區塊,並依序將來自主裝置110的資料依序寫入至這些區塊中。舉例來說,參考第10圖,假設每一個區域所對應到的資料量介於快閃記憶體模組124中兩個區塊至三個區塊之間,則快閃記憶體控制器122可以將區域Z1的資料依序寫入至區塊B3、B7以及B8中,其中區塊B3所記錄的是區域Z1的第一部分資料Z1_0、區塊B7所記錄的是區域Z1的第二部分資料Z1_1、而區塊B8所記錄的是區域Z1的第三部分資料Z1_2。在本實施例中,由於區塊B3、B7所儲存的資料完全是區域Z1的資料,而區塊B8僅有部分的資料頁儲存了區域Z1的資料,因此,為了充分利用區塊B8的剩餘資料頁,故微處理器212會將區塊B8設為共用區塊,亦即區塊B8的剩餘資料頁可以用來儲存其他區域的資料。繼續參考第10圖,快閃記憶體控制器122準備將區域Z3的資料寫入至區域命名空間310_1,而由於共用區塊B8尚有剩餘空間,故微處理器212選擇兩個空白區塊B12、B99以及共用區塊B8來儲存區域Z3的資料。具體來說,快閃記憶體控制器122將區域Z3的資料依序寫入至區塊B12、B99以及B8中,其中區塊B12所記錄的是區域Z3的第一部分資料Z3_0、區塊B99所記錄的是區域Z3的第二部分資料Z3_1、而區塊B8所記錄的是區域Z3的第三部分資料Z3_2。在本實施例中,區塊B12、B99所儲存的資料完全是區域Z3的資料,而區塊B8則會同時記錄了區域Z1的第三部分資料Z1_2以及區域Z3的第三部分資料Z3_2。請注意到,為了管理上的方便,快閃記憶體控制器122並不會將任何區域的第一筆資料儲存至共用區塊中,因為這會增加快閃記憶體控制器122在建立L2P映射表上的複雜度。快閃記憶體控制器122會把每個區域的第一筆資料儲存在專屬區塊中,例如區塊B3、B12。該些專屬區塊僅會儲存屬於同一區域的資料,故稱為專屬區塊。而任一個區域的最後一筆資料(對應於該區域最後一個邏輯位址的資料)都會儲存在共用區塊中,例如區塊B8,而該共用區塊中,也會儲存另一個區域的最後一筆資料。在此實施例中,共用區塊儲存了不只一個區域的資料,或者說共用區塊儲存了不只一個區域的最後一筆資料,而專屬區塊僅儲存單一區域的資料。Figure 9 is a flow chart for writing data from the main device 110 to the region namespace 310_1 according to another embodiment of the present invention. This embodiment assumes that the amount of data corresponding to each region is larger than the flash memory. The size of each block in the module 124, and the amount of data corresponding to each area is not an integer multiple of the size of each block in the flash memory module 124. In step 900, the process begins. The main device 110 and the storage device 120_1 are powered on and complete the initialization operation. The main device 110 sets basic settings such as the size of each area, the number of areas, and the size of the logical block address for the storage device 120_1, such as Set using the Zoned Namespaces Command Set. In step 902, the host device 110 sends a write command and corresponding data to the flash memory controller 122, where the data is data corresponding to one or more areas. For example, area Z3 in Figure 4 corresponds to a logical bit. The data of address LBA_k~LBA_(k+x-1). In step 904, the flash memory controller 122 selects at least one block (blank block, or spare block) from the flash memory module 124, or selects at least one blank block or at least a common block. blocks, and sequentially writes the data of the master device 110 into these blocks. For example, referring to Figure 10, assuming that the amount of data corresponding to each area is between two blocks and three blocks in the flash memory module 124, the flash memory controller 122 can Write the data of area Z1 to blocks B3, B7 and B8 in sequence. Block B3 records the first part of the data Z1_0 of area Z1, and block B7 records the second part of the data Z1_1 of area Z1. , and block B8 records the third part of data Z1_2 in area Z1. In this embodiment, since the data stored in blocks B3 and B7 are completely the data of area Z1, and only part of the data pages of block B8 store the data of area Z1, in order to make full use of the remaining data of block B8, data page, so the microprocessor 212 will set block B8 as a shared block, that is, the remaining data pages of block B8 can be used to store data in other areas. Continuing to refer to Figure 10, the flash memory controller 122 is preparing to write the data of area Z3 to the area name space 310_1. Since there is still space left in the shared block B8, the microprocessor 212 selects two empty blocks B12. , B99 and shared block B8 to store the data of area Z3. Specifically, the flash memory controller 122 writes the data in area Z3 to blocks B12, B99, and B8 in sequence, where block B12 records the first part of data Z3_0 in area Z3, and the data in block B99. What is recorded is the second part of data Z3_1 of area Z3, and what is recorded in block B8 is the third part of data Z3_2 of area Z3. In this embodiment, the data stored in blocks B12 and B99 are completely the data of area Z3, while block B8 simultaneously records the third part of data Z1_2 of area Z1 and the third part of data Z3_2 of area Z3. Please note that for the convenience of management, the flash memory controller 122 will not store the first data of any area into the common block, because this will increase the number of steps the flash memory controller 122 needs to create the L2P mapping table. on the complexity. The flash memory controller 122 will store the first data of each area in dedicated blocks, such as blocks B3 and B12. These exclusive blocks will only store data belonging to the same area, so they are called exclusive blocks. The last piece of data in any area (the data corresponding to the last logical address of the area) will be stored in a shared block, such as block B8, and the last piece of data in another area will also be stored in this shared block. material. In this embodiment, the shared block stores data of more than one area, or the shared block stores the last data of more than one area, while the dedicated block only stores data of a single area.

在步驟906中,快閃記憶體控制器122建立或更新一L2P映射表以紀錄邏輯位址與實體位址的映射關係,並記錄一共用區塊表,以供後續自區域命名空間310_1進行資料讀取時使用。第11A圖為根據本發明一實施例之L2P映射表1100A及共用區塊表1130A的示意圖。L2P映射表1100A包含了兩個欄位,其中一個欄位紀錄了邏輯位址、而另一個欄位則記錄了區塊的實體區塊位址。同時參考第10圖,由於區域Z1的資料依序寫入至區塊B3、B7及B8,且區域Z3的資料依序寫入至區塊B12、B99及B8,因此,L2P映射表1100A記錄了區域Z1的起始邏輯位址Z1_LBA_S及區塊B3的實體區塊位址PBA3、區域Z1的邏輯位址(Z1_LBA_S+y)及區塊B7的實體區塊位址PBA7、以及區域Z1的邏輯位址(Z1_LBA_S+2*y)及區塊B8的實體區塊位址PBA8,其中邏輯位址(Z1_LBA_S+y)可以是寫入至區塊B7之資料的第一個邏輯位址(亦即,第二部分資料Z1_1的第一個邏輯位址,且也是對應到區塊B7之第一個資料頁P1的邏輯位址),而邏輯位址(Z1_LBA_S+2*y)可以是寫入至區塊B8之資料的第一個邏輯位址(亦即,第三部分資料Z1_2的第一個邏輯位址);類似地,L2P映射表1100A記錄了區域Z3的起始邏輯位址Z3_LBA_S及區塊B12的實體區塊位址PBA12、區域Z3的邏輯位址(Z3_LBA_S+y)及區塊B99的實體區塊位址PBA99、以及區域Z6的邏輯位址(Z3_LBA_S+2*y)及區塊B6的實體區塊位址PBA6,其中邏輯位址(Z3_LBA_S+y)可以是寫入至區塊B99之資料的第一個邏輯位址(亦即,第二部分資料Z3_1的第一個邏輯位址,且也是對應到區塊B99之第一個資料頁P1的邏輯位址),而邏輯位址(Z3_LBA_S+2*y)可以是寫入至區塊B8之資料的第一個邏輯位址(亦即,第三部分資料Z3_2的第一個邏輯位址)。需注意的是,上述的“y”可以表示為一個區塊可以儲存多少筆來自主機的邏輯位址的資料。請注意到,由於主裝置110設定區域大小及區域個數之後,各個區域的起始邏輯位址就固定下來了,各個子區域的起始邏輯位址也固定下來了,例如Z1_LBA_S、Z1_LBA_S+y、Z1_LBA_S+2*y、Z2_LBA_S、Z2_LBA_S+y、Z2_LBA_S+2*y……等,因此,類似的,L2P映射表1100可以更進一步的化簡為一個欄位,即,僅有實體區塊位址欄位。而邏輯位址欄位即可利用表格的條目(entry)來代表,而無需實際儲存多個子區域的起始邏輯位址。請參考第11B圖的L2P映射表1100B,L2P映射表1100B的每個邏輯位址有固定的欄位,此及依照邏輯位址最低至最高排序(或最高至最低),例如Z0_LBA_S即代表區域0的起始邏輯位址,即系統中最低的邏輯位址,Z0_LBA_S+y即代表區域0第二個子區域的起始邏輯位址,其中y代表每個實體區塊用來存放主機資料的位址數目,Z0_LBA_S+2*y即代表區域0第三個子區域的起始邏輯位址,由於區域大小固定,y值也固定,所以第11B圖中的邏輯位址欄位中的數值具有相當高的可預測性,因此,也可省略該欄位,僅以L2P映射表1100B的條目(entry)來代表。In step 906, the flash memory controller 122 creates or updates an L2P mapping table to record the mapping relationship between the logical address and the physical address, and records a common block table for subsequent data processing from the regional namespace 310_1. Used when reading. Figure 11A is a schematic diagram of an L2P mapping table 1100A and a shared block table 1130A according to an embodiment of the present invention. The L2P mapping table 1100A includes two fields, one of which records the logical address, and the other field records the physical block address of the block. Referring to Figure 10 at the same time, since the data of area Z1 is written to blocks B3, B7, and B8 in sequence, and the data of area Z3 is written to blocks B12, B99, and B8 in order, the L2P mapping table 1100A records The starting logical address Z1_LBA_S of area Z1 and the physical block address PBA3 of block B3, the logical address (Z1_LBA_S+y) of area Z1, the physical block address PBA7 of block B7, and the logical bit of area Z1 address (Z1_LBA_S+2*y) and the physical block address PBA8 of block B8, where the logical address (Z1_LBA_S+y) can be the first logical address of the data written to block B7 (i.e., The first logical address of the second part of data Z1_1, and is also the logical address corresponding to the first data page P1 of block B7), and the logical address (Z1_LBA_S+2*y) can be written to the area The first logical address of the data of block B8 (that is, the first logical address of the third part of data Z1_2); similarly, the L2P mapping table 1100A records the starting logical address Z3_LBA_S and the block of area Z3 The physical block address PBA12 of B12, the logical address of area Z3 (Z3_LBA_S+y) and the physical block address PBA99 of block B99, and the logical address of area Z6 (Z3_LBA_S+2*y) and block B6 The physical block address PBA6, where the logical address (Z3_LBA_S+y) can be the first logical address of the data written to block B99 (that is, the first logical address of the second part of the data Z3_1 , and is also the logical address corresponding to the first data page P1 of block B99), and the logical address (Z3_LBA_S+2*y) can be the first logical address of the data written to block B8 ( That is, the first logical address of the third part of data Z3_2). It should be noted that the above "y" can be expressed as how many pieces of data from the host's logical address can be stored in a block. Please note that after the main device 110 sets the area size and number of areas, the starting logical address of each area is fixed, and the starting logical address of each sub-area is also fixed, such as Z1_LBA_S, Z1_LBA_S+y , Z1_LBA_S+2*y, Z2_LBA_S, Z2_LBA_S+y, Z2_LBA_S+2*y... etc. Therefore, similarly, the L2P mapping table 1100 can be further simplified to one field, that is, only the physical block position address field. The logical address field can be represented by an entry in the table without actually storing the starting logical addresses of multiple sub-regions. Please refer to the L2P mapping table 1100B in Figure 11B. Each logical address of the L2P mapping table 1100B has a fixed field, which is sorted from the lowest to the highest logical address (or highest to lowest). For example, Z0_LBA_S represents area 0. The starting logical address is the lowest logical address in the system. Z0_LBA_S+y represents the starting logical address of the second sub-area of area 0, where y represents the number of addresses used to store host data in each physical block. Z0_LBA_S+2*y represents the starting logical address of the third sub-area of area 0. Since the area size is fixed and the y value is also fixed, the value in the logical address field in Figure 11B is quite predictable. Therefore, this field can also be omitted and represented only by the entry of the L2P mapping table 1100B.

另外,共用區塊表1130A包含了兩個欄位,其中一個欄位紀錄了邏輯位址、而另一個欄位則記錄了邏輯位址所對應的實體區塊位址及實體資料頁位址。在第11A圖中,共用區塊表1130A記錄了區域Z1的第三部分資料Z1_2的第一個邏輯位址(Z1_LBA_S+2*y)及對應的實體區塊位址PBA8及實體資料頁位址P1,亦即第三部分資料Z1_2中對應到第一個邏輯位址的資料是寫在區塊B8的第一個資料頁P1;而共用區塊表1130A記錄了區域Z3的第三部分資料Z3_2的第一個邏輯位址(Z3_LBA_S+2*y)及對應的實體區塊位址PBA8及實體資料頁位址P120,亦即第三部分資料Z3_2中對應到第一個邏輯位址的資料是寫在區塊B8的第一百二十個資料頁P120(需注意,在此係假設區塊中每一個資料頁只能儲存一個邏輯位址的資料,實際情況可根據一個資料頁所能儲存多少個邏輯位址之資料來據以調整)。類似於第11B圖中的L2P映射表1100B,第11A圖中的共用區塊表1130A亦得以第11B圖中共用區塊表1130B的形式呈現,其理由亦同,於此不再贅述。In addition, the shared block table 1130A includes two fields, one of which records the logical address, and the other field records the physical block address and physical data page address corresponding to the logical address. In Figure 11A, the shared block table 1130A records the first logical address (Z1_LBA_S+2*y) of the third part of the data Z1_2 in the area Z1 and the corresponding physical block address PBA8 and the physical data page address. P1, that is, the data corresponding to the first logical address in the third part of data Z1_2 is written in the first data page P1 of block B8; and the shared block table 1130A records the third part of data Z3_2 of area Z3 The first logical address (Z3_LBA_S+2*y) and the corresponding physical block address PBA8 and physical data page address P120, that is, the data corresponding to the first logical address in the third part of data Z3_2 is The 120th data page P120 written in block B8 (note that this assumes that each data page in the block can only store data at one logical address. The actual situation can be based on what one data page can store. How many logical address data to adjust accordingly). Similar to the L2P mapping table 1100B in Figure 11B, the shared block table 1130A in Figure 11A is also presented in the form of the shared block table 1130B in Figure 11B. The reasons are the same and will not be repeated here.

另外,需注意的是,區域Z1以及區域Z3的資料在寫入的過程中,其寫入過程可能並非是在區域Z1的資料全部寫完後再開始將區域Z3的資料寫入至區域命名空間310_1,換句話說,有可能在區域Z1的資料尚未寫完時,快閃記憶體控制器122便需要將開始將區域Z3的資料寫入至區域命名空間310_1。因此,在本發明的另一個實施例中,共用區塊表1130可以另外包含一個完成指標欄位,其用來指出區域的資料在共用區塊是否已完全寫入。參考第12圖所示,其中第12圖所示之共用區塊表1230係延續第10圖的實施例。在第12圖(a)中,當區域Z1的第三部分資料Z1_2全部寫入至共同區塊B8之後,微處理器212會將完成指標由‘0’修改為‘1’,而之後微處理器212需要將區域Z3的第三部分資料Z3_2寫入至區域命名空間310_1時,由於對應到共同區塊B8之區域Z1的第三部分資料Z1_2的完成指標為‘1’,則微處理器212可以判斷共同區塊B8目前可供資料寫入,故將區域Z3的第三部分資料Z3_2寫入共同區塊B8,並在共用區塊表1230中記錄第三部分資料Z3_2及對應的實體區塊位址及實體資料頁位址。另一方面,在第12圖(b)中,當區域Z1的第三部分資料Z1_2在寫入至共同區塊B8的過程中,其對應的完成指標係為‘0’(代表區域Z1的第三部分資料Z1_2尚未全部寫入至共同區塊B8),而若是此時後微處理器212需要將區域Z3的第三部分資料Z3_2寫入至區域命名空間310_1,由於對應到共同區塊B8之區域Z1的第三部分資料Z1_2的完成指標為‘0’,則微處理器212可以判斷共同區塊B8目前不可以供第三部分資料Z3_2寫入,故微處理器212另外選擇一個空白區塊(例如區塊B15),並將區域Z3的第三部分資料Z3_2寫入至區塊B15中,並在共用區塊表1230中記錄三部分資料Z3_2及對應的實體區塊位址PBA15及實體資料頁位址P1。請注意到,第12圖中的共用區塊表1230亦得以類似第11B圖中的共用區塊表1130B的形式再追加完成指標欄位的形式呈現,以固定的邏輯位址位置取代邏輯位址欄位,其理由和L2P映射表1100B與共用區塊表1130B相同,於此不再贅述。In addition, it should be noted that during the writing process of the data in area Z1 and area Z3, the writing process may not start writing the data in area Z3 to the area namespace after all the data in area Z1 is written. 310_1, in other words, it is possible that the flash memory controller 122 needs to start writing the data of area Z3 into the area namespace 310_1 before the data of area Z1 has been written. Therefore, in another embodiment of the present invention, the shared block table 1130 may additionally include a completion indicator field, which is used to indicate whether the data of the area has been completely written in the shared block. Referring to Figure 12, the shared block table 1230 shown in Figure 12 is a continuation of the embodiment of Figure 10. In Figure 12(a), after the third part of data Z1_2 in area Z1 is all written to the common block B8, the microprocessor 212 will modify the completion indicator from '0' to '1', and then the microprocessor 212 will When the processor 212 needs to write the third part of the data Z3_2 of the area Z3 to the area name space 310_1, since the completion indicator of the third part of the data Z1_2 of the area Z1 corresponding to the common block B8 is '1', the microprocessor 212 It can be determined that the common block B8 is currently available for data writing, so the third part of the data Z3_2 in the area Z3 is written into the common block B8, and the third part of the data Z3_2 and the corresponding physical block are recorded in the common block table 1230 address and physical data page address. On the other hand, in Figure 12(b), when the third part of data Z1_2 of area Z1 is being written to the common block B8, its corresponding completion indicator is '0' (representing the third part of area Z1 The three parts of data Z1_2 have not yet been fully written to the common block B8), and if at this time the microprocessor 212 needs to write the third part of the data Z3_2 of the area Z3 to the area name space 310_1, since it corresponds to the common block B8 If the completion indicator of the third part data Z1_2 in area Z1 is '0', the microprocessor 212 can determine that the common block B8 is currently unavailable for the third part data Z3_2 to write, so the microprocessor 212 selects another blank block. (for example, block B15), and write the third part of data Z3_2 of area Z3 into block B15, and record the three parts of data Z3_2 and the corresponding physical block address PBA15 and physical data in the common block table 1230 Page address P1. Please note that the shared block table 1230 in Figure 12 is also presented in a form similar to the shared block table 1130B in Figure 11B with the completion indicator field added, replacing the logical address with a fixed logical address location. The reason for the field is the same as that of the L2P mapping table 1100B and the shared block table 1130B, and will not be described again here.

在一實施例中,若主裝置110欲重置(reset)一個區域,例如重置區域Z1,快閃記憶體控制器122通常會修改L2P映射表1100A/1100B將與區域Z1相對應的實體區塊位址的欄位給刪除掉,例如刪除L2P映射表1100A/1100B中的實體區塊位址PBA3、PBA7及PBA8,代表主機已經不再需要該些實體區塊所儲存的資料。而快閃記憶體控制器122可稍後再將該些實體區塊給抹除,請注意到,實體區塊B8中儲存了主裝置110欲儲存的資料以及以及區域Z3的資料,雖然主裝置110所欲重置的區域Z1並不包含區域Z3的資料。為了管理上的方便,快閃記憶體控制器122在收到主裝置110針對區域Z1的重置指令後,仍需修改共同區塊表1130A/1130B/1230中的實體區塊位址及實體資料頁位址,將PBA8、P1 給刪除掉,例如改寫為FFFF。請注意到,共同區塊表1230中的完成指標仍舊維持為1,因為區域Z1的第三部分仍舊Z1_3佔用了於實體區塊B8中的部分空間,在實體區塊B8被抹除之前,該些空間無法再被寫入。並且,快閃記憶體控制器122在抹除實體區塊B8之前,也可以不必將主裝置110發出的重置指令中所沒有包含到的有效資料(例如區域Z3的資料)給搬移到其他實體區塊去。In one embodiment, if the master device 110 wants to reset an area, such as the area Z1, the flash memory controller 122 usually modifies the L2P mapping table 1100A/1100B to change the physical area corresponding to the area Z1. The field of the block address is deleted, for example, deleting the physical block addresses PBA3, PBA7, and PBA8 in the L2P mapping table 1100A/1100B, which means that the host no longer needs the data stored in these physical blocks. The flash memory controller 122 can erase these physical blocks later. Please note that the physical block B8 stores the data to be stored by the main device 110 and the data of the area Z3. Although the main device 110 The area Z1 to be reset does not contain the data of area Z3. For management convenience, after receiving the reset command for area Z1 from the master device 110, the flash memory controller 122 still needs to modify the physical block address and physical data in the common block table 1130A/1130B/1230. For the page address, delete PBA8 and P1, for example, rewrite it as FFFF. Please note that the completion indicator in the common block table 1230 still remains at 1 because the third part of the area Z1 still occupies part of the space Z1_3 in the physical block B8. Before the physical block B8 is erased, the These spaces can no longer be written to. Furthermore, before erasing the physical block B8, the flash memory controller 122 does not need to move the valid data (such as the data in the area Z3) that is not included in the reset command issued by the host device 110 to other entities. Block to go.

在以上的實施例中,由於使用了共同區塊來儲存對應到不同區域的資料,故可視為邏輯位址屬於不同區域的資料可以被儲存在相同的實體區塊中,故可以有效地利用實體區塊的空間,避免因為區域大小與實體區塊大小的不齊致而導致當一區域所對應的邏輯位址已經完全寫入時,仍無法填滿整數個實體區塊的空間,而導致實體區塊中剩餘的資料頁沒有存入資料造成浪費。In the above embodiments, since a common block is used to store data corresponding to different areas, it can be regarded that data with logical addresses belonging to different areas can be stored in the same physical block, so physical blocks can be effectively used. The space of the block is to avoid the inconsistency between the area size and the physical block size. When the logical address corresponding to an area has been completely written, it still cannot fill the space of an integer physical block, resulting in physical The remaining data pages in the block do not store data, causing waste.

需注意的是,本實施例的L2P映射表1100A/1100B僅包含了區域命名空間310_1的實體區塊位址,而不會包含任何的資料頁位址,亦即L2P映射表1100A/1100B不會記錄任何區塊內的資料頁序號或相關的資料頁資訊。此外,共同區塊表1130A/1130B/1230也只會記錄少量的邏輯位址,甚至因為共同區塊表1130A/1130B/1230的邏輯位址係極度規律,亦可省略邏輯位址欄位,而僅用表格的條目(entry)來代表。因此,L2P映射表1100A/1100B及共同區塊表1130A/1130B/1230本身僅具有很小的資料量,故L2P映射表1100A/1100B及共同區塊表1130A/1130B/1230可以常駐在緩衝記憶體216或是DRAM 240,而不會對緩衝記憶體216或DRAM 240的儲存空間造成太大的負擔。It should be noted that the L2P mapping table 1100A/1100B in this embodiment only contains the physical block address of the area namespace 310_1, and does not contain any data page address. That is, the L2P mapping table 1100A/1100B does not Record the data page serial number or related data page information in any block. In addition, the common block table 1130A/1130B/1230 will only record a small number of logical addresses. Even because the logical addresses of the common block table 1130A/1130B/1230 are extremely regular, the logical address field can be omitted. Represented only by table entries. Therefore, the L2P mapping table 1100A/1100B and the common block table 1130A/1130B/1230 themselves only have a small amount of data, so the L2P mapping table 1100A/1100B and the common block table 1130A/1130B/1230 can reside in the buffer memory 216 or DRAM 240 without causing too much burden on the storage space of the buffer memory 216 or DRAM 240.

此外,由於L2P映射表1100A/1100B的(Z1_LBA_S+2*y)、(Z3_LBA_S+2*y)……等該區域中最後一部分的欄位所對應到的實體區塊位址並非精確的實體位址,微處理器212需要再透過查找共同區塊表1130A/1130B/1230來找到正確的實體頁位址,因此,也可將L2P映射表1100A/1100B的(Z1_LBA_S+2*y) 、(Z3_LBA_S+2*y)……等該區域中最後一部分的欄位所對應的實體位址例如PBA8直接改成共同區塊表1130A/1130B/1230相對應的條目位址,讓微處理器212直接存取共同區塊表1130A/1130B/1230相對應的條目位址。例如將L2P映射表1100A/1100B的(Z1_LBA_S+2*y)欄位對應的PBA8直接改成共同區塊表1130A/1130B中(Z1_LBA_S+2*y)欄位所對應的記憶體位址,將L2P映射表1100A/1100B的(Z3_LBA_S+2*y)欄位對應的PBA8直接改成共同區塊表1130A/1130B中(Z3_LBA_S+2*y)欄位所對應的記憶體位址(例如在DRAM或是SRAM中的位址),加速查找速度。In addition, because the physical block addresses corresponding to the last part of the fields in the area such as (Z1_LBA_S+2*y), (Z3_LBA_S+2*y)... of the L2P mapping table 1100A/1100B are not accurate physical locations, address, the microprocessor 212 needs to find the correct physical page address by searching the common block table 1130A/1130B/1230. Therefore, (Z1_LBA_S+2*y) and (Z3_LBA_S of the L2P mapping table 1100A/1100B can also be +2*y)... Wait until the entity address corresponding to the last part of the field in the area, such as PBA8, is directly changed to the entry address corresponding to the common block table 1130A/1130B/1230, allowing the microprocessor 212 to directly store Get the entry address corresponding to the common block table 1130A/1130B/1230. For example, directly change the PBA8 corresponding to the (Z1_LBA_S+2*y) field in the L2P mapping table 1100A/1100B to the memory address corresponding to the (Z1_LBA_S+2*y) field in the common block table 1130A/1130B, and change the L2P The PBA8 corresponding to the (Z3_LBA_S+2*y) field in the mapping table 1100A/1100B is directly changed to the memory address corresponding to the (Z3_LBA_S+2*y) field in the common block table 1130A/1130B (for example, in DRAM or address in SRAM) to speed up the search speed.

第13圖為根據本發明一實施例之自區域命名空間310_1讀取資料的流程圖,其中本實施例係假設區域命名空間310_1已經儲存了第10圖所示之區域Z1及Z3的資料。在步驟1300中,流程開始,主裝置110及儲存裝置120_1上電並完成初始化操作(例如,開機程序)。在步驟1302,主裝置110發送一讀入指令以要求讀取具有一特定邏輯位址的資料。在步驟1304,快閃記憶體控制器122中的微處理器212判斷出該特定邏輯位址是屬於哪一個區域,並根據L2P映射表1100A/1100B及/或共同區塊表1130A/1130B/1230所記錄的邏輯位址來計算出該特定邏輯位址所對應的一實體資料頁位址。以第11A圖的L2P映射表1100A來做為說明,由於L2P映射表1100A記錄了多個區域的多個邏輯位址,且這些邏輯位址分別對應到區塊B3、B7、B8的第幾個資料頁,再加上每一個區塊可以儲存之邏輯位址的數量為已知,因此,微處理器212可以由上述資訊來得知該特定邏輯位址是屬於哪一個區域以及哪一個區塊。接著,假設該特定邏輯位址是屬於區域Z1,則微處理器212根據該特定邏輯位址與區域Z1的邏輯位址(例如,Z1_LBA_S、(Z1_LBA_S+y)或(Z1_LBA_S+2y))之間的差距,再根據區塊之每一個資料頁所能夠儲存多少邏輯位址的資料,來決定出該特定邏輯位址所對應的該實體資料頁位址。為了方便說明,假設區塊中每一個資料頁只能儲存一個邏輯位址的資料,則該特定邏輯位址與區域Z1的起始邏輯位址Z1_LBA_S之間的差距為五百個邏輯位址,且該特定邏輯位址介於Z1_LBA_S與(Z1_LBA_S+y)之間(其中y代表每個實體區塊用來存放主機資料的位址數目,而在此例中y>500),則微處理器212可以計算出該特定邏輯位址對應到區塊B3的第五百個資料頁P500的實體資料頁位址,在此例中,微處理器212將差距500除以y,得到商為0,餘數500,則微處理器212可以得知特定邏輯位址所對應的實體區塊位址應在L2P映射表1100A的第一個條目,查找後,微處理器212發現特定邏輯位址所對應的實體區塊位址為實體區塊位址為PBA3。而由於餘數為500,微處理器212可以得知特定邏輯位址所對應的實體頁位址係P500,請注意到除了以實體頁為單位之外,亦得以更小的讀取單位定址,例如扇區(sector)或是4Kbyte等其他符合NVMe規範的定址單位;另一方面,假設該特定邏輯位址是屬於區域Z3,則微處理器212根據該特定邏輯位址與區域Z3的邏輯位址(例如,Z3_LBA_S、(Z3_LBA_S+y)或(Z3_LBA_S+2y))之間的差距,再根據區塊之每一個資料頁所能夠儲存多少邏輯位址的資料,來決定出該特定邏輯位址所對應的該實體資料頁位址。為了方便說明,假設區塊中每一個資料頁只能儲存一個邏輯位址的資料,該特定邏輯位址大於(Z3_LBA_S+2y)並小於或等於區域Z3之最大邏輯位址,且該特定邏輯位址與區域Z3之邏輯位址(Z3_LBA_S+2y)之間的差距為八十個邏輯位址,則微處理器212可以參考共用區塊表1130所記錄之區域Z3之第三部分資料Z3_2所對應的實體資料頁位址P120,並據以計算出該特定邏輯位址對應到共用區塊B8的第兩百個資料頁P200的實體資料頁位址。Figure 13 is a flow chart of reading data from the area namespace 310_1 according to an embodiment of the present invention. This embodiment assumes that the area namespace 310_1 has already stored the data of the areas Z1 and Z3 shown in Figure 10. In step 1300, the process starts. The main device 110 and the storage device 120_1 are powered on and complete the initialization operation (for example, the boot process). In step 1302, the master device 110 sends a read command to request to read data with a specific logical address. In step 1304, the microprocessor 212 in the flash memory controller 122 determines which area the specific logical address belongs to, and determines the area according to the L2P mapping table 1100A/1100B and/or the common block table 1130A/1130B/1230 The recorded logical address is used to calculate a physical data page address corresponding to the specific logical address. Take the L2P mapping table 1100A in Figure 11A as an illustration. The L2P mapping table 1100A records multiple logical addresses in multiple areas, and these logical addresses correspond to the numbers of blocks B3, B7, and B8 respectively. The data page and the number of logical addresses that can be stored in each block are known. Therefore, the microprocessor 212 can know which area and which block the specific logical address belongs to based on the above information. Next, assuming that the specific logical address belongs to the area Z1, the microprocessor 212 determines the relationship between the specific logical address and the logical address of the area Z1 (for example, Z1_LBA_S, (Z1_LBA_S+y) or (Z1_LBA_S+2y)). The difference is determined based on how much data of the logical address can be stored in each data page of the block to determine the physical data page address corresponding to the specific logical address. For the convenience of explanation, assuming that each data page in the block can only store data at one logical address, the gap between this specific logical address and the starting logical address Z1_LBA_S of area Z1 is 500 logical addresses. And the specific logical address is between Z1_LBA_S and (Z1_LBA_S+y) (where y represents the number of addresses used to store host data in each physical block, and in this example y>500), then the microprocessor 212 can calculate that the specific logical address corresponds to the physical data page address of the 500th data page P500 of block B3. In this example, the microprocessor 212 divides the difference 500 by y to obtain a quotient of 0, The remainder is 500, then the microprocessor 212 can know that the physical block address corresponding to the specific logical address should be in the first entry of the L2P mapping table 1100A. After searching, the microprocessor 212 finds that the physical block address corresponding to the specific logical address should be in the first entry of the L2P mapping table 1100A. The physical block address is PBA3. Since the remainder is 500, the microprocessor 212 can know that the physical page address corresponding to the specific logical address is P500. Please note that in addition to using the physical page as the unit, it can also be addressed in smaller read units, such as Sector or 4Kbyte and other addressing units that comply with the NVMe specification; on the other hand, assuming that the specific logical address belongs to area Z3, the microprocessor 212 determines the specific logical address and the logical address of area Z3 according to the specific logical address. (For example, the difference between Z3_LBA_S, (Z3_LBA_S+y) or (Z3_LBA_S+2y)), and then based on how much data at the logical address can be stored in each data page of the block, the location of the specific logical address is determined. The corresponding address of the entity data page. For the convenience of explanation, it is assumed that each data page in the block can only store data at one logical address. The specific logical address is greater than (Z3_LBA_S+2y) and less than or equal to the maximum logical address of area Z3, and the specific logical address The gap between the address and the logical address of area Z3 (Z3_LBA_S+2y) is eighty logical addresses, then the microprocessor 212 can refer to the third part of the data Z3_2 of area Z3 recorded in the common block table 1130 corresponding to The physical data page address P120 is calculated, and the physical data page address corresponding to the two-hundredth data page P200 of the shared block B8 is calculated accordingly.

在步驟1306,微處理器212根據在步驟1304中所決定出的實體區塊位址及實體資料頁位址,自區域命名空間310_1中讀取對應的資料,並將所讀取的資料回傳至主裝置110。In step 1306, the microprocessor 212 reads the corresponding data from the area namespace 310_1 according to the physical block address and the physical data page address determined in step 1304, and returns the read data. to the main device 110.

如上所述,透過以上實施例所述的內容,快閃記憶體控制器122可以在僅建立出很小尺寸之L2P映射表1100A/1100B及共同資料表1130A/1130B/1230,仍然可以有效地完成區域命名空間310_1的資料寫入及讀取。As mentioned above, through the content described in the above embodiments, the flash memory controller 122 can only create a very small size of the L2P mapping table 1100A/1100B and the common data table 1130A/1130B/1230, and still can effectively complete the task. Data writing and reading of area namespace 310_1.

在以上第5~13圖的實施例中係假設每一個區域所對應到的資料量大於快閃記憶體模組124中每一個區塊的大小,然而,主裝置110亦可將每一個區域所對應到的資料量低於快閃記憶體模組124中每一個區塊的大小,其相關的存取方式如下所述。In the above embodiments of Figures 5 to 13, it is assumed that the amount of data corresponding to each area is larger than the size of each block in the flash memory module 124. However, the main device 110 can also store the data in each area. The corresponding amount of data is less than the size of each block in the flash memory module 124, and its related access methods are as follows.

第14圖為根據本發明另一實施例之將來自主裝置110的資料寫入至區域命名空間310_1的流程圖,其中本實施例係假設每一個區域所對應到的資料量係小於快閃記憶體模組124中每一個區塊的大小。在步驟1400中,流程開始,主裝置110及儲存裝置120_1上電並完成初始化操作,主裝置110對儲存裝置120_1設定每個區域的大小、區域數量、邏輯區塊位址大小等基本設定,例如利用區域命名空間指令集(Zoned Namespaces Command Set)進行設定。在步驟1402,主裝置110發送一寫入指令以及對應的資料至快閃記憶體控制器122,其中上述資料為對應到一或多個區域的資料,例如第4圖中區域Z3之對應到邏輯位址LBA_k~LBA_(k+x-1)的資料。在步驟1404中,快閃記憶體控制器122自區域命名空間310_1中選擇至少一個區塊(空白區塊、或稱備用區塊),並依邏輯位址順序將來自主裝置110的資料依序寫入至該至少一個區塊中。在本實施例中,一個區塊只會用來寫入單一個區域的資料,以第15圖為例,快閃記憶體控制器122將區域Z0的資料寫入至區塊B20、將區域Z1的資料寫入至區塊B30、將區域Z2的資料寫入至區塊B35、…以此類推。在步驟1406中,當每一個區域的資料完全寫入之後,快閃記憶體控制器122會將每一個區塊中系統控制用以外的剩餘資料頁寫入無效資料,或是直接將剩餘資料頁維持空白狀態。以第15圖為例,在快閃記憶體控制器122將區域Z0的資料全部寫入至區塊B20後區塊會將B20的剩餘資料頁維持空白或是填入無效資料,在快閃記憶體控制器122將區域Z1的資料全部寫入至區塊B30後會將區塊B30的剩餘資料頁維持空白或是填入無效資料、且在快閃記憶體控制器122將區域Z2的資料全部寫入至區塊B35後會將區塊B35的剩餘資料頁維持空白或是填入無效資料。Figure 14 is a flow chart for writing data from the main device 110 to the region namespace 310_1 according to another embodiment of the present invention. This embodiment assumes that the amount of data corresponding to each region is smaller than the flash memory. The size of each block in module 124. In step 1400, the process begins. The main device 110 and the storage device 120_1 are powered on and complete the initialization operation. The main device 110 sets basic settings such as the size of each area, the number of areas, and the logical block address size on the storage device 120_1, for example Set using the Zoned Namespaces Command Set. In step 1402, the host device 110 sends a write command and corresponding data to the flash memory controller 122, where the data is data corresponding to one or more areas, such as area Z3 in Figure 4 corresponding to the logic Data at addresses LBA_k~LBA_(k+x-1). In step 1404, the flash memory controller 122 selects at least one block (blank block, or spare block) from the area name space 310_1, and sequentially writes data from the master device 110 in logical address order. into the at least one block. In this embodiment, one block is only used to write data in a single area. Taking Figure 15 as an example, the flash memory controller 122 writes data in area Z0 to block B20 and area Z1. The data of area Z2 is written to block B30, the data of area Z2 is written to block B35,... and so on. In step 1406, after the data in each area is completely written, the flash memory controller 122 will write the remaining data pages in each block that are not used for system control into invalid data, or directly write the remaining data pages into invalid data. Maintain a blank state. Taking Figure 15 as an example, after the flash memory controller 122 writes all the data in area Z0 to block B20, the block will keep the remaining data pages of B20 blank or fill in invalid data. After writing all the data in area Z1 to block B30, the bank controller 122 will keep the remaining data pages of block B30 blank or fill in invalid data, and the flash memory controller 122 will write all the data in area Z2. After writing to block B35, the remaining data pages of block B35 will remain blank or filled with invalid data.

請注意到,在一實施例中,主裝置110係針對區域Z0、Z1、Z2連續的邏輯位址發送寫入指令,而快閃記憶體控制器122選擇了區塊B20、B30、B35用以儲存屬於區域Z0、Z1、Z2的資料。由於裝置110所設定的區域大小與實體區塊的大小並不齊致,主裝置110所欲寫入的資料仍無法填滿實體區塊的儲存空間,例如無法填滿實體區塊B20用來儲存主機資料的儲存空間,因此快閃記憶體控制器122仍舊要將實體區塊B20內該些儲存空間留白或是填入無效資料,所以儘管主裝置110針對區域Z0、Z1內連續的邏輯位址發送寫入指令,而且在實體區塊B20仍有空間儲存資料的狀況下,快閃記憶體控制器122仍舊不會將區域Z1的起始邏輯位址所對應的資料儲存在實體區塊B20之中,換言之,即便主裝置110發送了連續邏輯位址的寫入命令(例如包含了區域Z0的最後一個邏輯位址與區域Z1的第一個邏輯位址的寫入命令),且某一特定實體區塊(例如實體區塊B20)有足夠的空間儲存該些連續邏輯位址的資料,快閃記憶體控制器122仍舊不會將該些連續邏輯位址所對應的資料連續地儲存在該特定實體區塊中,而是跳躍性的將區域Z1的第一個邏輯位址所對應的資料寫入另一個實體區塊,例如區塊B30中。相應地,主裝置110若針對區域Z0、Z1內連續的邏輯位址發送讀取指令(例如包含了區域Z0的最後一個邏輯位址與區域Z1的第一個邏輯位址的讀取命令),快閃記憶體控制器122在讀取儲存在實體區塊B20中對應區域Z1的最後一個邏輯位址的資料之後,也會跳躍性地去讀取區塊B30的第一個儲存位置,以取得區域Z1的第一個邏輯位址的資料。Please note that in one embodiment, the master device 110 sends write instructions to the consecutive logical addresses of areas Z0, Z1, and Z2, and the flash memory controller 122 selects blocks B20, B30, and B35 for Store data belonging to areas Z0, Z1, and Z2. Since the area size set by the device 110 is not consistent with the size of the physical block, the data to be written by the main device 110 still cannot fill the storage space of the physical block. For example, the physical block B20 cannot be filled for storage. The storage space of the host data, so the flash memory controller 122 still needs to leave these storage spaces in the physical block B20 blank or fill them with invalid data, so although the main device 110 targets the continuous logical bits in the areas Z0 and Z1 The flash memory controller 122 still does not store the data corresponding to the starting logical address of the area Z1 in the physical block B20 when the physical block B20 still has space to store data. In other words, even if the master device 110 sends write commands with consecutive logical addresses (for example, a write command including the last logical address of area Z0 and the first logical address of area Z1), and a certain A specific physical block (such as physical block B20) has enough space to store the data of the continuous logical addresses, and the flash memory controller 122 still does not continuously store the data corresponding to the continuous logical addresses in the In this specific physical block, the data corresponding to the first logical address of area Z1 is jumped to be written into another physical block, such as block B30. Correspondingly, if the master device 110 sends a read command for consecutive logical addresses in areas Z0 and Z1 (for example, a read command including the last logical address of area Z0 and the first logical address of area Z1), After reading the data stored in the last logical address of the corresponding area Z1 in the physical block B20, the flash memory controller 122 will also jump to read the first storage location of the block B30 to obtain Data of the first logical address of area Z1.

在步驟1408中,快閃記憶體控制器122建立或更新一L2P映射表以紀錄邏輯位址與實體位址的映射關係,以供後續自區域命名空間310_1進行資料讀取時使用。第16圖為根據本發明一實施例之L2P映射表1600的示意圖。L2P映射表1600包含了兩個欄位,其中一個欄位紀錄了區域編號或是相關可辨識的內容、而另一個欄位則記錄了區塊的實體區塊位址。同時參考第6圖,由於區域Z0、Z1、Z2的資料分別寫入至區塊B20、B30、B35,因此,L2P映射表1600記錄了區域Z0及區塊B20的實體區塊位址PBA20、區域Z1及區塊B30的實體區塊位址PBA30、以及區域Z2及區塊B35的實體區塊位址PBA35。在另一實施例中,上述的區域編號以區域的起始邏輯位址來表示、或是區塊編號可以透過另外的查找表來連結到區塊的起始邏輯位址,舉例來說,假設區域Z0係用來儲存具有邏輯位址LBA_1~LBA_2000的資料、區域Z1係用來儲存具有邏輯位址LBA_2001~LBA_4000的資料、區域Z2係用來儲存具有邏輯位址LBA_4001~LBA_6000的資料,則區域Z0、Z1、Z2的起始邏輯位址即分別是LBA_1、LBA_2001、LBA_4001。請注意到,在此實施例中,每個實體區塊均只對應到一個區域,例如區塊B20、B30及B35只分別對應到區域Z0、Z1、Z2。或者說,單一區塊只儲存單一個區域的資料,例如區塊B20只儲存區域Z0所對應的資料,區塊B30只儲存區域Z1所對應的資料,區塊B35只儲存區域Z2所對應的資料。In step 1408, the flash memory controller 122 creates or updates an L2P mapping table to record the mapping relationship between logical addresses and physical addresses for subsequent use in reading data from the region namespace 310_1. Figure 16 is a schematic diagram of an L2P mapping table 1600 according to an embodiment of the present invention. The L2P mapping table 1600 includes two fields, one of which records the area number or related identifiable content, and the other field records the physical block address of the block. Referring to Figure 6 at the same time, since the data of areas Z0, Z1, and Z2 are written to blocks B20, B30, and B35 respectively, the L2P mapping table 1600 records the physical block addresses PBA20 and areas of area Z0 and block B20. The physical block address PBA30 of Z1 and block B30, and the physical block address PBA35 of area Z2 and block B35. In another embodiment, the above-mentioned area number is represented by the starting logical address of the area, or the block number can be linked to the starting logical address of the block through another lookup table. For example, suppose Area Z0 is used to store data with logical addresses LBA_1~LBA_2000, area Z1 is used to store data with logical addresses LBA_2001~LBA_4000, area Z2 is used to store data with logical addresses LBA_4001~LBA_6000, then the area The starting logical addresses of Z0, Z1, and Z2 are LBA_1, LBA_2001, and LBA_4001 respectively. Please note that in this embodiment, each physical block only corresponds to one area. For example, blocks B20, B30, and B35 only correspond to areas Z0, Z1, and Z2 respectively. In other words, a single block only stores data in a single area. For example, block B20 only stores data corresponding to area Z0, block B30 only stores data corresponding to area Z1, and block B35 only stores data corresponding to area Z2. .

在以上的實施例中,區域命名空間310_1內的任何一個實體區塊所儲存的資料都一定是屬於相同的區域,亦即,任何一個實體區塊內所儲存的所有資料的邏輯位址會屬於同一個區域。因此,本實施例的L2P映射表1600可以僅包含了區域命名空間310_1的實體區塊位址,而不會包含任何的資料頁位址,亦即L2P映射表1600不會記錄任何區塊內的資料頁序號或相關的資料頁資訊。此外,L2P映射表1600也僅會記錄每一個區域的區域編號或是起始邏輯位址,因此,L2P映射表1600本身僅具有很小的資料量,故2P映射表1600可以常駐在緩衝記憶體216或是DRAM 240,而不會對緩衝記憶體216或DRAM 240的儲存空間造成太大的負擔。在一實施例中,上述L2P映射表1600中所記錄的實體區塊位址可以另外搭配第一個資料頁的實體資料頁位址,而額外增加一個實體資料頁位址在實務上不會對儲存空間造成太大的負擔。請注意到,由於主裝置110設定區域大小及區域個數之後,各個區域的起始邏輯位址就固定下來了,因此,類似的,L2P映射表1600可以更進一步的化簡為一個欄位,即,僅有實體區塊位址欄位。而邏輯位址欄位即可利用表格的條目(entry)來代表,而無需實際儲存多個區域的起始邏輯位址。In the above embodiment, the data stored in any physical block in the area namespace 310_1 must belong to the same area. That is, the logical addresses of all the data stored in any physical block will belong to same area. Therefore, the L2P mapping table 1600 in this embodiment may only include the physical block address of the area namespace 310_1, and will not include any data page addresses. That is, the L2P mapping table 1600 will not record any data in the block. Data page serial number or related data page information. In addition, the L2P mapping table 1600 only records the area number or starting logical address of each area. Therefore, the L2P mapping table 1600 itself only has a small amount of data, so the 2P mapping table 1600 can be resident in the buffer memory. 216 or DRAM 240 without causing too much burden on the storage space of the buffer memory 216 or DRAM 240. In one embodiment, the physical block address recorded in the above-mentioned L2P mapping table 1600 can be additionally matched with the physical data page address of the first data page, and adding an additional physical data page address will not be practical. Storage space creates too big a burden. Please note that after the main device 110 sets the area size and the number of areas, the starting logical address of each area is fixed. Therefore, similarly, the L2P mapping table 1600 can be further simplified into one field. That is, there is only the physical block address field. The logical address field can be represented by an entry in the table without actually storing the starting logical addresses of multiple areas.

除此之外,若主裝置110欲重置(reset)一個區域,例如重置區域Z1,快閃記憶體控制器122通常會修改L2P映射表1600將與區域Z1相對應的實體區塊位址的欄位給刪除掉,例如刪除L2P映射表1600中的實體區塊位址PBA30,代表主機已經不再需要該些實體區塊所儲存的資料。而快閃記憶體控制器122可稍後再將該些實體區塊給抹除,請注意到,實體區塊B30中儲存了主裝置110欲儲存的資料以及無效資料,雖然主裝置110所欲重置的區域Z1並不包含該些無效資料。為了管理上的方便,快閃記憶體控制器122在收到主裝置110針對區域Z1的重置指令後,仍會整體性地刪除L2P映射表1600中的實體區塊位址PBA30,即便主裝置110所欲重置的區域Z1並不包含實體區塊B30中所儲存的該些無效資料。並且,快閃記憶體控制器122在抹除實體區塊B30之前,也不會將主裝置110發出的重置指令中所沒有包含到的無效資料給搬移到其他實體區塊去,而是將整個實體區塊直接刪除。In addition, if the host device 110 wants to reset an area, such as the area Z1, the flash memory controller 122 usually modifies the L2P mapping table 1600 to the physical block address corresponding to the area Z1. Delete the fields, for example, delete the physical block address PBA30 in the L2P mapping table 1600, which means that the host no longer needs the data stored in these physical blocks. The flash memory controller 122 can erase these physical blocks later. Please note that the physical block B30 stores the data that the main device 110 wants to store and the invalid data. Although the main device 110 wants to The reset area Z1 does not contain the invalid data. For management convenience, after receiving the reset command for area Z1 from the master device 110, the flash memory controller 122 will still delete the physical block address PBA30 in the L2P mapping table 1600 as a whole, even if the master device 110 The area Z1 to be reset does not contain the invalid data stored in the physical block B30. Moreover, before erasing the physical block B30, the flash memory controller 122 will not move the invalid data not included in the reset command issued by the master device 110 to other physical blocks, but will The entire entity block is deleted directly.

第17圖為根據本發明另一實施例之自區域命名空間310_1讀取資料的流程圖,其中本實施例係假設區域命名空間310_1已經儲存了第15圖所示之區域Z0、Z1及Z2的資料。在步驟1700中,流程開始,主裝置110及儲存裝置120_1上電並完成初始化操作(例如,開機程序)。在步驟1702,主裝置110發送一讀入指令以要求讀取具有一特定邏輯位址的資料。在步驟1704,快閃記憶體控制器122中的微處理器212判斷出該特定邏輯位址是屬於哪一個區域,並根據L2P映射表1600所記錄的邏輯位址來計算出該特定邏輯位址所對應的一實體資料頁位址。以第16圖的L2P映射表1600來做為說明,由於L2P映射表1600記錄了每個區域的區域編號或起始邏輯位址,再加上每一個區域之邏輯位址的數量為已知,因此,微處理器212可以由上述資訊來得知該特定邏輯位址是屬於哪一個區域,舉例來說,一個區域包含2000個邏輯位址,微處理器212將主機所欲存取的邏輯位址(特定邏輯位址)除以2000,所得到的商,即為該特定邏輯位址所在的區域,以第15、16圖的實施例來做說明,假設微處理器212將該特定邏輯位址除以2000後,發現商為1,即可判斷該特定邏輯位址屬於區域Z1,則微處理器212根據該特定邏輯位址與區域Z1的起始邏輯位址之間的差距(該差距亦為該微處理器212將該特定邏輯位址除以2000後之餘數),再根據區塊之每一個資料頁所能夠儲存多少邏輯位址的資料,來決定出該特定邏輯位址所對應的該實體資料頁位址。為了方便說明,假設區塊中每一個資料頁只能儲存一個邏輯位址的資料,且該特定邏輯位址與區域Z1的起始邏輯位址之間的差距為兩百個邏輯位址,則微處理器212可以計算出該特定邏輯位址對應到區塊B20的第兩百個資料頁的實體資料頁位址。Figure 17 is a flow chart of reading data from the area namespace 310_1 according to another embodiment of the present invention. This embodiment assumes that the area namespace 310_1 has stored the areas Z0, Z1 and Z2 shown in Figure 15. material. In step 1700, the process starts. The main device 110 and the storage device 120_1 are powered on and complete the initialization operation (for example, the boot process). In step 1702, the master device 110 sends a read command to request reading of data with a specific logical address. In step 1704, the microprocessor 212 in the flash memory controller 122 determines which area the specific logical address belongs to, and calculates the specific logical address according to the logical address recorded in the L2P mapping table 1600. The corresponding address of an entity data page. Take the L2P mapping table 1600 in Figure 16 as an illustration. Since the L2P mapping table 1600 records the area number or starting logical address of each area, and the number of logical addresses in each area is known, Therefore, the microprocessor 212 can know which area the specific logical address belongs to based on the above information. For example, an area contains 2000 logical addresses. The microprocessor 212 determines the logical address that the host wants to access. (specific logical address) divided by 2000, the obtained quotient is the area where the specific logical address is located. The embodiments in Figures 15 and 16 are used for illustration. It is assumed that the microprocessor 212 converts the specific logical address After dividing by 2000, it is found that the quotient is 1, and it can be judged that the specific logical address belongs to area Z1. Then the microprocessor 212 determines the specific logical address according to the difference between the specific logical address and the starting logical address of area Z1 (the difference is also The microprocessor 212 divides the specific logical address by 2000), and then determines the data corresponding to the specific logical address based on how much data of the logical address can be stored in each data page of the block. The address of the entity data page. For the convenience of explanation, assume that each data page in the block can only store data at one logical address, and the difference between this specific logical address and the starting logical address of area Z1 is two hundred logical addresses, then The microprocessor 212 can calculate that the specific logical address corresponds to the physical data page address of the two hundredth data page of block B20.

在步驟1706,微處理器212根據在步驟1704中所決定出的實體區塊位址及實體資料頁位址,自區域命名空間310_1中讀取對應的資料,並將所讀取的資料回傳至主裝置110。In step 1706, the microprocessor 212 reads the corresponding data from the area namespace 310_1 according to the physical block address and the physical data page address determined in step 1704, and returns the read data. to the main device 110.

如上所述,透過以上實施例所述的內容,快閃記憶體控制器122可以在僅建立出很小尺寸之L2P映射表700/720的情形下,仍然可以有效地完成區域命名空間310_1的資料寫入及讀取。然而,在此實施例中,仍會有大量的實體區塊儲存空間被浪費掉,例如第15圖中所示之空白或無效資料頁。As mentioned above, through the contents described in the above embodiments, the flash memory controller 122 can still effectively complete the data of the area namespace 310_1 while only establishing a very small size of the L2P mapping table 700/720. writing and reading. However, in this embodiment, a large amount of physical block storage space is still wasted, such as blank or invalid data pages as shown in Figure 15.

第18圖為根據本發明另一實施例之將來自主裝置110的資料寫入至區域命名空間310_1的流程圖,其中本實施例係假設每一個區域所對應到的資料量係小於快閃記憶體模組124中每一個區塊的大小。在步驟1800中,流程開始,主裝置110及儲存裝置120_1上電並完成初始化操作,主裝置110對儲存裝置120_1設定每個區域的大小、區域數量、邏輯區塊位址大小等基本設定,例如利用區域命名空間指令集(Zoned Namespaces Command Set)進行設定。在步驟1802,主裝置110發送一寫入指令以及對應的資料至快閃記憶體控制器122,其中上述資料為對應到一或多個區域的資料,例如第4圖中區域Z3之對應到邏輯位址LBA_k~LBA_(k+x-1)的資料。在步驟1804中,快閃記憶體控制器122自區域命名空間310_1中選擇至少一個區塊(空白區塊、或稱備用區塊)、或是選擇多個空白區塊與一共用區塊,並依一個區域內的邏輯位址順序將來自主裝置110的資料依序寫入至這些區塊中。舉例來說,參考第19圖,快閃記憶體控制器122可以依邏輯位址順序將區域Z0、Z2、Z1的資料依序寫入至區塊B20、B30中。以第19圖為例,區域Z0的第一筆資料係由區塊B20的第一個資料頁開始寫入,且在區域Z0的資料都寫入完成之後,請參考第20圖的L2P映射表2000,該表將於下詳述之,快閃記憶體控制器122將區域編號Z0所對應的可用指標從0改成1,代表區域編號Z0的資料都寫入完成,區域編號Z0所儲存之實體區塊PBA20所剩餘的空間可以再被拿來儲存其他資料。因為實體區塊PBA20所剩餘的空間可以再被拿來儲存其他資料,所以區域Z2的資料也可以接著寫入至區塊B20的剩餘資料頁,倘若快閃記憶體控制器122在處理區域Z2的寫入指令時,找不到任何一個實體區塊其所對應的可用指標為1,則快閃記憶體控制器122應該要提取一個空白區塊或者備用區塊用以寫入區域Z2的資料。Figure 18 is a flow chart for writing data from the master device 110 to the region namespace 310_1 according to another embodiment of the present invention. This embodiment assumes that the amount of data corresponding to each region is smaller than the flash memory. The size of each block in module 124. In step 1800, the process begins. The main device 110 and the storage device 120_1 are powered on and complete the initialization operation. The main device 110 sets basic settings such as the size of each area, the number of areas, and the size of the logical block address for the storage device 120_1, such as Set using the Zoned Namespaces Command Set. In step 1802, the host device 110 sends a write command and corresponding data to the flash memory controller 122, where the data is data corresponding to one or more areas, such as area Z3 in Figure 4 corresponding to the logic Data at addresses LBA_k~LBA_(k+x-1). In step 1804, the flash memory controller 122 selects at least one block (blank block, or spare block) from the area name space 310_1, or selects multiple blank blocks and a common block, and The data of the master device 110 is sequentially written into these blocks according to the logical address sequence within a region. For example, referring to FIG. 19, the flash memory controller 122 can sequentially write the data of areas Z0, Z2, and Z1 into blocks B20 and B30 in logical address order. Taking Figure 19 as an example, the first data in area Z0 is written starting from the first data page of block B20. After all the data in area Z0 is written, please refer to the L2P mapping table in Figure 20. In 2000, the table will be described in detail below. The flash memory controller 122 changes the available index corresponding to the area number Z0 from 0 to 1, which means that the data in the area number Z0 is completely written, and the data stored in the area number Z0 is completed. The remaining space in the physical block PBA20 can be used to store other data. Because the remaining space in the physical block PBA20 can be used to store other data, the data in area Z2 can also be written to the remaining data pages in block B20. If the flash memory controller 122 is processing the data in area Z2. When writing instructions, if no physical block is found and its corresponding available index is 1, the flash memory controller 122 should extract a blank block or a spare block to write data in area Z2.

在此例中,由於實體區塊PBA20所對應的可用指標為1,所以快閃記憶體控制器122可以直接利用實體區塊PBA20儲存區域Z2的資料而無需提取另一個空白區塊或是備用區塊。而由於區塊B20的剩餘資料頁的數量並不足以儲存區域Z2的所有資料,因此,區域Z2的資料被分為第一部分Z2_1以及第二部分Z2_2,其中第一部分Z2_1儲存在區塊B20,而第二部分Z2_2則由快閃記憶體控制器122提取另一個空白區塊,區塊B30,並由區塊B30的第一個資料頁開始寫入。由於在將Z2第一部分Z2_1寫滿區塊B20的剩餘資料頁之後,實體區塊PBA20已滿,無法再寫入資料,因此快閃記憶體控制器122會將區域Z0所對應的可用指標改為0,且讓區域Z2_1所對應的可用指標維持為0。在區域Z2的第二部分Z2_2都寫入完成之後,快閃記憶體控制器122將區域編號Z2_2所對應的可用指標從0改成1,類似地,區域Z1的資料也接著開始寫入至區塊B30的剩餘資料頁。In this example, since the available index corresponding to the physical block PBA20 is 1, the flash memory controller 122 can directly use the physical block PBA20 to store the data in the area Z2 without extracting another blank block or spare area. block. Since the number of remaining data pages in block B20 is not enough to store all the data in area Z2, the data in area Z2 is divided into the first part Z2_1 and the second part Z2_2, where the first part Z2_1 is stored in block B20, and In the second part Z2_2, the flash memory controller 122 extracts another blank block, block B30, and starts writing from the first data page of block B30. Since the physical block PBA20 is full after the first part Z2_1 of Z2 is filled with the remaining data pages of the block B20, and no more data can be written, the flash memory controller 122 will change the available index corresponding to the area Z0 to 0, and let the available indicators corresponding to area Z2_1 remain at 0. After the writing of the second part Z2_2 of area Z2 is completed, the flash memory controller 122 changes the available index corresponding to the area number Z2_2 from 0 to 1. Similarly, the data of area Z1 also starts to be written to the area. The remaining data pages of block B30.

在步驟1806中,快閃記憶體控制器122建立或更新一L2P映射表以紀錄邏輯位址與實體位址的映射關係,以供後續自區域命名空間310_1進行資料讀取時使用。第20圖為根據本發明一實施例之L2P映射表2000的示意圖。L2P映射表2000包含了兩個欄位,其中一個欄位紀錄了區塊編號或邏輯位址區間、而另一個欄位則記錄了該邏輯位址區間之第一個邏輯位址所對應的實體區塊位址及實體資料頁位址。在第20圖中,L2P映射表2000記錄了區域Z0或區域Z0的邏輯位址區間之第一個邏輯位址,以及對應的實體區塊位址PBA20及實體資料頁位址P1、區域Z2之第一部份Z2_1的邏輯位址區間及該區間第一個邏輯位址所對應的實體區塊位址PBA20及實體資料頁位址Pa、區域Z2之第二部份Z2_2的邏輯位址區間及該區間第一個邏輯位址所對應的實體區塊位址PBA30及實體資料頁位址P1、及區域Z1或區域Z1的邏輯位址區間及該區間第一個邏輯位址所對應的實體區塊位址PBA30及實體資料頁位址Pb。請注意到,在此例中,一個寫滿資料的實體區塊均儲存了複數個區域的資料。In step 1806, the flash memory controller 122 creates or updates an L2P mapping table to record the mapping relationship between logical addresses and physical addresses for subsequent use in reading data from the region namespace 310_1. Figure 20 is a schematic diagram of an L2P mapping table 2000 according to an embodiment of the present invention. The L2P mapping table 2000 contains two fields, one of which records the block number or logical address range, and the other field records the entity corresponding to the first logical address of the logical address range. Block address and entity data page address. In Figure 20, the L2P mapping table 2000 records area Z0 or the first logical address of the logical address range of area Z0, as well as the corresponding physical block address PBA20 and the physical data page address P1 and area Z2. The logical address range of the first part Z2_1 and the physical block address PBA20 and physical data page address Pa corresponding to the first logical address of the range, the logical address range of the second part Z2_2 of the area Z2 and The physical block address PBA30 and the physical data page address P1 corresponding to the first logical address of the interval, and the area Z1 or the logical address interval of area Z1 and the physical area corresponding to the first logical address of the interval The block address PBA30 and the physical data page address Pb. Please note that in this example, a physical block filled with data stores multiple areas of data.

另外,需注意的是,區域Z0、Z2、以及區域Z1的資料在寫入的過程中,其寫入過程可能並非是在區域Z0的資料全部寫完後再開始將區域Z1的資料寫入至區域命名空間310_1,換句話說,有可能在區域Z0的資料尚未寫完時,快閃記憶體控制器122便需要將開始將區域Z1的資料寫入至區域命名空間310_1。因此,如上所述,在本發明的另一個實施例中,L2P映射表2000可以另外包含一個可用指標欄位,其用來指出區域的資料在共用區塊是否已完全寫入。In addition, it should be noted that during the writing process of the data in areas Z0, Z2, and area Z1, the writing process may not start writing the data in area Z1 after all the data in area Z0 is written. Region namespace 310_1, in other words, it is possible that the flash memory controller 122 needs to start writing the data of region Z1 into the region namespace 310_1 before the data of region Z0 has been written. Therefore, as mentioned above, in another embodiment of the present invention, the L2P mapping table 2000 may additionally include an available indicator field, which is used to indicate whether the data of the area has been completely written in the shared block.

在以上的實施例中,由於L2P映射表2000儲存了對應到不同區域的資料在區塊內的位址關係,故可視為邏輯位址屬於不同區域的資料可以被儲存在相同的實體區塊中,故可以有效地利用實體區塊的空間。In the above embodiments, since the L2P mapping table 2000 stores the address relationship within the block corresponding to the data in different areas, it can be considered that data with logical addresses belonging to different areas can be stored in the same physical block. , so the space of the physical block can be effectively utilized.

需注意的是,本實施例的L2P映射表2000只會記錄少量的邏輯位址(少量的實體資料頁位址),因此L2P映射表2000本身僅具有很小的資料量,故L2P映射表2000可以常駐在緩衝記憶體216或是DRAM 240,而不會對緩衝記憶體216或DRAM 240的儲存空間造成太大的負擔。It should be noted that the L2P mapping table 2000 in this embodiment will only record a small number of logical addresses (a small number of physical data page addresses). Therefore, the L2P mapping table 2000 itself only has a small amount of data. Therefore, the L2P mapping table 2000 It can reside in the buffer memory 216 or the DRAM 240 without causing too much burden on the storage space of the buffer memory 216 or the DRAM 240 .

第21圖為根據本發明一實施例之自區域命名空間310_1讀取資料的流程圖,其中本實施例係假設區域命名空間310_1已經儲存了第19圖所示之區域Z1、Z1及Z2的資料。在步驟2100中,流程開始,主裝置110及儲存裝置120_1上電並完成初始化操作(例如,開機程序)。在步驟2102,主裝置110發送一讀入指令以要求讀取具有一特定邏輯位址的資料。在步驟2104,快閃記憶體控制器122中的微處理器212判斷出該特定邏輯位址是屬於哪一個區域,並根據L2P映射表2000所記錄的區域編號或邏輯位址來計算出該特定邏輯位址所對應的一實體資料頁位址。以第20圖的L2P映射表2000來做為說明,由於L2P映射表2000記錄了個區域的區塊編號或邏輯位址區間,再加上每一個區塊可以儲存之邏輯位址的數量為已知,因此,微處理器212可以由上述資訊來得知該特定邏輯位址是屬於哪一個區域以及哪一個區塊。接著,假設該特定邏輯位址是屬於區域Z0,則微處理器212根據該特定邏輯位址與區域Z0的起始邏輯位址之間的差距,再根據區塊之每一個資料頁所能夠儲存多少邏輯位址的資料,來決定出該特定邏輯位址所對應的該實體資料頁位址。Figure 21 is a flow chart of reading data from the area namespace 310_1 according to an embodiment of the present invention. This embodiment assumes that the area namespace 310_1 has stored the data of the areas Z1, Z1 and Z2 shown in Figure 19 . In step 2100, the process starts. The main device 110 and the storage device 120_1 are powered on and complete the initialization operation (for example, the boot process). In step 2102, the master device 110 sends a read command to request reading data with a specific logical address. In step 2104, the microprocessor 212 in the flash memory controller 122 determines which area the specific logical address belongs to, and calculates the specific area number or logical address according to the area number or logical address recorded in the L2P mapping table 2000. A physical data page address corresponding to the logical address. Take the L2P mapping table 2000 in Figure 20 as an illustration. Since the L2P mapping table 2000 records the block number or logical address range of an area, plus the number of logical addresses that each block can store is Therefore, the microprocessor 212 can know which area and which block the specific logical address belongs to based on the above information. Next, assuming that the specific logical address belongs to the area Z0, the microprocessor 212 determines the difference between the specific logical address and the starting logical address of the area Z0, and then determines the data that each data page of the block can store. How many logical addresses of data are needed to determine the physical data page address corresponding to the specific logical address.

在步驟2106,微處理器212根據在步驟2104中所決定出的實體區塊位址及實體資料頁位址,自區域命名空間310_1中讀取對應的資料,並將所讀取的資料回傳至主裝置110。In step 2106, the microprocessor 212 reads the corresponding data from the area namespace 310_1 according to the physical block address and the physical data page address determined in step 2104, and returns the read data. to the main device 110.

如上所述,透過以上實施例所述的內容,快閃記憶體控制器122可以在僅建立出很小尺寸之L2P映射表2000的情形下,仍然可以有效地完成區域命名空間310_1的資料寫入及讀取。As mentioned above, through the contents described in the above embodiments, the flash memory controller 122 can still effectively complete the data writing of the area namespace 310_1 while only establishing a very small size of the L2P mapping table 2000. and read.

參考以上第5~21圖所示的實施例,第5~7圖描述了每一個區域所對應到的資料量大於快閃記憶體模組124中每一個區塊的大小,且快閃記憶體模組124中的每一個區塊僅會儲存對應到單一個區域的資料,亦即不同區域的資料不會寫入至相同的實體區塊中。第8~12圖描述了每一個區域所對應到的資料量大於快閃記憶體模組124中每一個區塊的大小,且快閃記憶體模組124中有部分的區塊會儲存對應到多個區域的資料,亦即不同區域的資料可以寫入至相同的實體區塊中。第13~17圖描述了每一個區域所對應到的資料量小於快閃記憶體模組124中每一個區塊的大小,且快閃記憶體模組124中的每一個區塊僅會儲存對應到單一個區域的資料,亦即不同區域的資料不會寫入至相同的實體區塊中。第18~21圖描述了每一個區域所對應到的資料量小於快閃記憶體模組124中每一個區塊的大小,且快閃記憶體模組124中的區塊會儲存對應到多個區域的資料,亦即不同區域的資料可以寫入至相同的實體區塊中。Referring to the embodiments shown in Figures 5 to 21 above, Figures 5 to 7 describe that the amount of data corresponding to each area is greater than the size of each block in the flash memory module 124, and the flash memory Each block in the module 124 will only store data corresponding to a single area, that is, data in different areas will not be written to the same physical block. Figures 8 to 12 describe that the amount of data corresponding to each area is larger than the size of each block in the flash memory module 124, and some blocks in the flash memory module 124 will store the corresponding Data in multiple areas, that is, data in different areas, can be written to the same physical block. Figures 13 to 17 illustrate that the amount of data corresponding to each area is less than the size of each block in the flash memory module 124, and each block in the flash memory module 124 only stores the corresponding Data to a single area, that is, data in different areas will not be written to the same physical block. Figures 18 to 21 illustrate that the amount of data corresponding to each area is less than the size of each block in the flash memory module 124, and the blocks in the flash memory module 124 will store multiple Regional data, that is, data in different regions can be written to the same physical block.

在一實施例中,上述四種存取模式可以選擇性地被應用在快閃記憶體模組124的區域命名空間中,且若是快閃記憶體模組124具有多個區域命名空間,這些區域命名空間也可以採用不同的存取模式。具體來說,參考第3圖所示,快閃記憶體控制器122內的微處理器212可以根據區域命名空間310_1之每一個區域的大小來選擇所採用的存取模式,舉例來說,若是區域命名空間310_1之每一個區域所對應到的資料量大於快閃記憶體模組124中每一個區塊的大小,微處理器212可以採用第5~7圖所提到之存取模式或是第8~12圖所提到之存取模式來對區域命名空間310_1進行存取;若是區域命名空間310_2之每一個區域所對應到的資料量小於快閃記憶體模組124中每一個區塊的大小,微處理器212可以採用第13~17圖所提到之存取模式或是第18~21圖所提到之存取模式來對區域命名空間310_2進行存取。同樣地,快閃記憶體控制器122內的微處理器212可以根據區域命名空間310_2之每一個區域的大小來選擇所採用的存取模式,而區域命名空間310_2所採用之存取模式並非一定要與區域命名空間310_1相同,例如區域命名空間310_1可以採用第5~7圖所提到之存取模式、而區域命名空間310_2則可以採用第8~12圖所提到之存取模式。In one embodiment, the above four access modes can be selectively applied in the region namespace of the flash memory module 124, and if the flash memory module 124 has multiple region namespaces, these regions Namespaces can also use different access modes. Specifically, referring to FIG. 3 , the microprocessor 212 in the flash memory controller 122 can select the access mode to be used according to the size of each area in the area name space 310_1. For example, if The amount of data corresponding to each area of the area namespace 310_1 is larger than the size of each block in the flash memory module 124. The microprocessor 212 can adopt the access mode mentioned in Figures 5 to 7 or The access mode mentioned in Figures 8 to 12 is used to access the area namespace 310_1; if the amount of data corresponding to each area of the area namespace 310_2 is less than each block in the flash memory module 124 The microprocessor 212 can use the access modes mentioned in Figures 13 to 17 or the access modes mentioned in Figures 18 to 21 to access the area name space 310_2. Similarly, the microprocessor 212 in the flash memory controller 122 can select the access mode to be used according to the size of each area of the area namespace 310_2, and the access mode used by the area namespace 310_2 is not certain. It should be the same as the area namespace 310_1. For example, the area namespace 310_1 can adopt the access mode mentioned in Figures 5 to 7, and the area namespace 310_2 can adopt the access mode mentioned in Figures 8 to 12.

請注意到,由於快閃記憶體控制器122無法事先得知主裝置110所欲設定的區域大小,如果為了讓快閃記憶體控制器122能夠與所有符合規範的主裝置互相搭配,快閃記憶體控制器122必須要有能力執行第5~21圖所示的實施例的所有存取方式。舉例來說,快閃記憶體控制器122在得知快閃記憶體模組124的單一實體區塊大小(或是超級區塊大小,超級區塊之概念將於下詳述)以及主裝置110所設定的區域大小之後,可以依照實體區塊大小及區域大小規劃出主裝置實際可以使用的記憶體空間,並選擇應當依照上述四種存取模式中哪一種方式進行存取。Please note that since the flash memory controller 122 cannot know in advance the area size to be set by the host device 110, in order to allow the flash memory controller 122 to cooperate with all host devices that meet the specifications, the flash memory controller 122 must The bank controller 122 must be capable of executing all access methods of the embodiments shown in Figures 5 to 21. For example, the flash memory controller 122 learns the single physical block size (or super block size, the concept of super block will be discussed in detail below) of the flash memory module 124 and the main device 110 After setting the area size, you can plan the actual memory space that can be used by the main device according to the physical block size and area size, and select which of the above four access modes should be used for access.

倘若區域大小小於實體區塊大小,則快閃記憶體控制器122得選擇第13~21圖的方式進行存取。由於第13~17圖所提到之存取模式可能會浪費較多的記憶體空間,甚至可能會導致快閃記憶體控制器122無法規劃出足夠的記憶體空間給主機使用,例如,依此存取模式,快閃記憶體控制器122僅能將總容量2TB的快閃記憶體模組規劃出1.2TB的容量供主裝置110使用,而主裝置可能期待至少需要1.5TB的容量可以使用,則快閃記憶體控制器122需要改變其存取模式。例如快閃記憶體控制器122可以改成第18~21圖的方式進行存取,由於依此種存取模式,將會大大減少快閃記憶體空間的浪費,因此快閃記憶體控制器122可以規劃出較多的容量供主裝置110使用,例如快閃記憶體控制器122可將總容量2TB的快閃記憶體模組規劃出1.8TB的容量供主裝置110使用,如此一來則可滿足主裝置110對記憶體儲存空間的使用需求。換句話說,上述主裝置110可能期待的容量可以視為一標準,而當區域命名空間在採用第13~17圖的存取方式時所規劃的容量高於主裝置110的該標準時,則快閃記憶體控制器122可以選擇第13~17圖的存取方式;另外,若是區域命名空間在採用第13~17圖的存取方式時所規劃的容量低於主裝置110的該標準時,則快閃記憶體控制器122可以選擇第18~21圖的存取方式。If the area size is smaller than the physical block size, the flash memory controller 122 has to select the methods shown in Figures 13 to 21 for access. Since the access modes mentioned in Figures 13 to 17 may waste more memory space, it may even cause the flash memory controller 122 to be unable to plan enough memory space for the host to use. For example, as follows In access mode, the flash memory controller 122 can only plan a flash memory module with a total capacity of 2TB to have a capacity of 1.2TB for the main device 110 to use, and the main device may expect at least 1.5TB of capacity to be used. Then the flash memory controller 122 needs to change its access mode. For example, the flash memory controller 122 can be changed to the method shown in Figures 18 to 21 for access. Since this access mode will greatly reduce the waste of flash memory space, the flash memory controller 122 More capacity can be planned for the main device 110 to use. For example, the flash memory controller 122 can plan a flash memory module with a total capacity of 2TB to have a capacity of 1.8TB for the main device 110 to use. In this way, The memory storage space usage requirement of the main device 110 is met. In other words, the capacity that the main device 110 may expect can be regarded as a standard. When the planned capacity of the regional namespace is higher than the standard of the main device 110 when using the access methods in Figures 13 to 17, the speed will be reduced. The flash memory controller 122 can select the access methods in Figures 13 to 17; in addition, if the planned capacity of the regional namespace is lower than the standard of the main device 110 when using the access methods in Figures 13 to 17, then The flash memory controller 122 can select the access modes shown in Figures 18 to 21.

倘若區域大小大於實體區塊大小,則快閃記憶體控制器122得選擇第5~12圖的方式進行存取。由於第5~7圖所提到之存取模式可能會浪費較多的記憶體空間,甚至可能會導致快閃記憶體控制器122無法規劃出足夠的記憶體空間給主機使用,例如,依此存取模式,快閃記憶體控制器122僅能將總容量2TB的快閃記憶體模組規劃出1.2TB的容量供主裝置110使用,而主裝置可能期待至少需要1.5TB的容量可以使用,則快閃記憶體控制器122需要改變其存取模式。例如快閃記憶體控制器122可以改成第8~12圖的方式進行存取,由於依此種存取模式,將會大大減少快閃記憶體空間的浪費,因此快閃記憶體控制器122可以規劃出較多的容量供主裝置110使用,例如快閃記憶體控制器122可將總容量2TB的快閃記憶體模組規劃出1.8TB的容量供主裝置110使用,如此一來則可滿足主裝置110對記憶體儲存空間的使用需求。換句話說,上述主裝置110可能期待的容量可以視為一標準,而當區域命名空間在採用第5~7圖的存取方式時所規劃的容量高於主裝置110的該標準時,則快閃記憶體控制器122可以選擇第5~7圖的存取方式;另外,若是區域命名空間在採用第5~7圖的存取方式時所規劃的容量低於主裝置110的該標準時,則快閃記憶體控制器122可以選擇第8~12圖的存取方式。If the area size is larger than the physical block size, the flash memory controller 122 has to select the methods shown in Figures 5 to 12 for access. Since the access modes mentioned in Figures 5 to 7 may waste more memory space, it may even cause the flash memory controller 122 to be unable to plan enough memory space for the host to use. For example, as follows In access mode, the flash memory controller 122 can only plan a flash memory module with a total capacity of 2TB to have a capacity of 1.2TB for the main device 110 to use, and the main device may expect at least 1.5TB of capacity to be used. Then the flash memory controller 122 needs to change its access mode. For example, the flash memory controller 122 can be changed to the method shown in Figures 8 to 12 for access. Since this access mode will greatly reduce the waste of flash memory space, the flash memory controller 122 More capacity can be planned for the main device 110 to use. For example, the flash memory controller 122 can plan a flash memory module with a total capacity of 2TB to have a capacity of 1.8TB for the main device 110 to use. In this way, The memory storage space usage requirement of the main device 110 is met. In other words, the capacity that the main device 110 may expect can be regarded as a standard, and when the planned capacity of the regional namespace is higher than the standard of the main device 110 when using the access methods in Figures 5 to 7, the fast The flash memory controller 122 can select the access methods in Figures 5 to 7; in addition, if the planned capacity of the regional namespace is lower than the standard of the main device 110 when using the access methods in Figures 5 to 7, then The flash memory controller 122 can select the access modes shown in Figures 8 to 12.

第25圖為根據本發明一實施例之應用於一快閃記憶體控制器的控制方法的流程圖。參考以上實施例所述的內容,控制方法的流程如下所述:Figure 25 is a flow chart of a control method applied to a flash memory controller according to an embodiment of the present invention. With reference to the contents described in the above embodiments, the flow of the control method is as follows:

步驟2500:流程開始。Step 2500: The process starts.

步驟2502:接收來自一主裝置的設定指令,其中該設定指令係將快閃記憶體模組的至少一部份設定為一區域命名空間,其中該區域命名空間係邏輯性地包含多個區域,該主裝置對於該區域命名空間的資料寫入存取必須要以區域為單位來進行,每一個區域的大小都是相同的,每一個區域內所對應到的邏輯位址必須要是連續的,且區域之間不會有重疊的邏輯位址。Step 2502: Receive a setting command from a host device, wherein the setting command sets at least a portion of the flash memory module as a region namespace, wherein the region namespace logically includes multiple regions, The master device must write and access data in the area namespace in units of areas. The size of each area is the same. The logical addresses corresponding to each area must be continuous, and There will be no overlapping logical addresses between regions.

步驟2504:利用一第一存取模式、一第二存取模式、一第三存取模式及一第四存取模式中的其一,以將來自該主裝置的資料寫入至該快閃記憶體模組中,其中該資料為一特定區域的所有資料。Step 2504: Use one of a first access mode, a second access mode, a third access mode, and a fourth access mode to write data from the host device to the flash In the memory module, the data is all the data in a specific area.

步驟2506:若是利用該第一存取模式,根據該資料之邏輯位址的順序,以依序將該資料寫入至該快閃記憶體模組的多個特定區塊中。Step 2506: If the first access mode is used, write the data into multiple specific blocks of the flash memory module sequentially according to the order of the logical addresses of the data.

步驟2508:當該資料完成寫入之後,將該多個特定區塊之最後一個特定區塊的剩餘資料頁寫入無效資料、或是將剩餘資料頁維持空白而不寫入任何資料。Step 2508: After the data is completely written, invalid data is written into the remaining data page of the last specific block of the plurality of specific blocks, or the remaining data page is kept blank without writing any data.

步驟2510:若是利用該第二存取模式,根據該資料之邏輯位址的順序,以依序將該資料寫入至該快閃記憶體模組的該多個特定區塊中。Step 2510: If the second access mode is used, write the data into the specific blocks of the flash memory module sequentially according to the order of the logical addresses of the data.

步驟2512:當該資料完成寫入之後,使用一完成指標以將該多個特定區塊之最後一個特定區塊標註為寫入完成。Step 2512: After the data is completely written, use a completion indicator to mark the last specific block of the plurality of specific blocks as writing completion.

步驟2514:若是利用該第三存取模式,根據該資料之邏輯位址的順序,以依序將該資料寫入至該快閃記憶體模組的單一個特定區塊中。Step 2514: If the third access mode is used, write the data to a single specific block of the flash memory module sequentially according to the sequence of the logical addresses of the data.

步驟2516:當該資料完成寫入之後,將該特定區塊的剩餘資料頁寫入無效資料、或是將剩餘資料頁維持空白而不寫入任何資料。Step 2516: After the data is completely written, invalid data is written into the remaining data pages of the specific block, or the remaining data pages are kept blank without writing any data.

步驟2518:若是利用該第四存取模式,根據該資料之邏輯位址的順序,以依序將該資料寫入至該快閃記憶體模組的單一個個特定區塊中。Step 2518: If the fourth access mode is used, write the data into individual specific blocks of the flash memory module in sequence according to the sequence of the logical addresses of the data.

步驟2520:當該資料完成寫入之後,使用一完成指標以將該特定區塊標註為寫入完成。Step 2520: After the data is completely written, use a completion indicator to mark the specific block as being written complete.

請注意到,在另一實施例中,為了讓控制器122的設計更簡單,控制器122也可以僅支援以上四種存取模式中單一種存取模式,或是控制器122也可以僅支援以上四種存取模式中兩種存取模式,或是控制器122也可以僅支援以上四種存取模式中三種存取模式,得依照特定的快閃記憶體模組及主裝置進行設計。Please note that in another embodiment, in order to make the design of the controller 122 simpler, the controller 122 may only support a single access mode among the above four access modes, or the controller 122 may only support Two of the above four access modes, or the controller 122 can only support three of the above four access modes, must be designed according to the specific flash memory module and host device.

此外,在本發明之一實施例中,儲存裝置120_1可以是一安全數位卡(Secure Digital Memory Card),其支援傳統安全數位模式的資料傳輸,亦即採用UHS-I輸入/輸出通訊介面標準來與主裝置110進行通訊,且也支援同時支援PCIe通道與NVMe協定的PCIe模式。In addition, in one embodiment of the present invention, the storage device 120_1 may be a Secure Digital Memory Card, which supports data transmission in the traditional secure digital mode, that is, using the UHS-I input/output communication interface standard. Communicates with the host device 110, and also supports PCIe mode that supports both the PCIe channel and the NVMe protocol.

在快閃記憶體模組124的實作上,快閃記憶體控制器122會將快閃記憶體模組124內部之屬於不同資料面(plane)的區塊組態為一個超級區塊,以方便在資料存取上的管理。具體來說,參考第22圖所示之快閃記憶體模組124之一般儲存空間320_1的示意圖。如第22圖所示,一般儲存空間320_1包含兩個通道(channel),通道1及通道2,分別連接了多個快閃記憶體晶片(chip)2210、2220、2230、2240,其中快閃記憶體晶片2210包含了兩個資料面(plane)2212、2214,快閃記憶體晶片2220包含了兩個資料面2222、2224,快閃記憶體晶片2230包含了兩個資料面2232、2234,快閃記憶體晶片2240包含了兩個資料面2242、2244,且每一個資料面均包含了多個區塊B0~BN。快閃記憶體控制器122在組態或初始化一般儲存空間320_1的過程中,會將每一個資料面的第一個區塊B0組態為一超級區塊2261、每一個資料面的第二個區塊B1組態為一超級區塊2262、…、以此類推。如第22圖所示,超級區塊2261包含了八個實體區塊,而快閃記憶體控制器122在存取超級區塊2261時則類似於一般區塊,舉例來說,超級區塊2261本身即是一個抹除單位,亦即超級區塊2261的之八個區塊B0雖然可以分開進行抹除操作,但是快閃記憶體控制器122卻一定會將八個區塊B0一起進行抹除;此外,超級區塊2261在進行資料寫入時可依序由資料面2212的第一個資料頁、資料面2214的第一個資料頁、資料面2222的第一個資料頁、資料面2224的第一個資料頁進行資料寫入,而直到資料面2244的第一個資料頁完成資料寫入之後,再將資料依序寫入至由2212的第二個資料頁、資料面2214的第二個資料頁、…、以此類推,換言之,快閃記憶體控制器122會將超級區塊2261中每個區塊B0的第一個資料頁寫滿後,才接著寫超級區塊2261中每個區塊B0的第二個資料頁。超級區塊係快閃記憶體控制器122為了方便管理儲存空間320_1而在邏輯上設定之一集合區塊,並非物理上之集合區塊。此外,在進行垃圾收集、計算區塊有效頁、計算區塊寫入時間長短時,也都可以超級區塊為單位來進行計算。在本發明的教導之下,熟悉此項技藝者,當可搭配第5~21圖所示的實施例,理解在第5~21圖所示的實施例所提到之一實體區塊,也可以是一超級區塊,所有的相關的實施例均可利用超級區塊來實現,而非侷限於單一個實體區塊。In the implementation of the flash memory module 124, the flash memory controller 122 configures the blocks belonging to different data planes (planes) inside the flash memory module 124 as a super block, so as to Facilitates management of data access. Specifically, refer to the schematic diagram of the general storage space 320_1 of the flash memory module 124 shown in FIG. 22 . As shown in Figure 22, the general storage space 320_1 includes two channels, channel 1 and channel 2, which are connected to multiple flash memory chips (chips) 2210, 2220, 2230, and 2240 respectively. The bulk chip 2210 includes two data planes 2212 and 2214, the flash memory chip 2220 includes two data planes 2222 and 2224, and the flash memory chip 2230 includes two data planes 2232 and 2234. The memory chip 2240 includes two data planes 2242 and 2244, and each data plane includes a plurality of blocks B0~BN. During the process of configuring or initializing the general storage space 320_1, the flash memory controller 122 will configure the first block B0 of each data plane as a super block 2261, and the second block B0 of each data plane. Block B1 is configured as a super block 2262,..., and so on. As shown in Figure 22, the super block 2261 includes eight physical blocks, and the flash memory controller 122 is similar to a normal block when accessing the super block 2261. For example, the super block 2261 It is itself an erasure unit, that is, although the eight blocks B0 of the super block 2261 can be erased separately, the flash memory controller 122 will definitely erase the eight blocks B0 together. ; In addition, when writing data to the super block 2261, the first data page of the data plane 2212, the first data page of the data plane 2214, the first data page of the data plane 2222, and the first data page of the data plane 2224 can be sequentially written. Write data to the first data page of data page 2244, and then write data to the second data page of data page 2212, and then write data to the second data page of data page 2214 in sequence. Two data pages, ..., and so on. In other words, the flash memory controller 122 will write the first data page of each block B0 in the super block 2261 until it is full, and then continue to write the data in the super block 2261. The second data page of each block B0. The super block is a logical set block set by the flash memory controller 122 in order to facilitate the management of the storage space 320_1, and is not a physical set block. In addition, when performing garbage collection, calculating block valid pages, and calculating the length of block writing time, calculations can also be performed in units of super blocks. Under the teachings of the present invention, those who are familiar with this art can use the embodiments shown in Figures 5 to 21 to understand that one of the physical blocks mentioned in the embodiments shown in Figures 5 to 21 can also It can be a super block, and all relevant embodiments can be implemented using super blocks instead of being limited to a single physical block.

然而,在快閃記憶體控制器122將快閃記憶體模組124內的區塊組態為超級區塊的情形下,若是採用第5~8圖的實施例來進行資料存取,則很有可能會造成每一個區塊都有很多剩餘資料頁(空白資料頁)的情形,因而浪費快閃記憶體模組124的內部空間。舉例來說,假設主裝置110所規劃之區域之資料量大小約為六個實體區塊的大小,則包含八個區塊的超級區塊2261所儲存的資料量僅會有六個實體區塊大小的資料量,亦即超級區塊2261中約有兩個區塊的儲存空間便因為要維持空白或是要寫入無效資料而浪費了。因此,本發明一實施例提出了一種根據主裝置110所設定之區域的資料量來組態區域命名空間310_1的方法,以有效率地使用區域命名空間310_1。However, when the flash memory controller 122 configures the blocks in the flash memory module 124 as super blocks, it is very difficult to access data if the embodiments of Figures 5 to 8 are used. It is possible that each block has many remaining data pages (blank data pages), thus wasting the internal space of the flash memory module 124 . For example, assuming that the data size of the area planned by the main device 110 is about the size of six physical blocks, the data amount stored in the eight-block super block 2261 will only be six physical blocks. A large amount of data, that is, about two blocks of storage space in super block 2261, is wasted by keeping it blank or writing invalid data. Therefore, an embodiment of the present invention proposes a method of configuring the area namespace 310_1 according to the data amount of the area set by the host device 110, so as to efficiently use the area namespace 310_1.

第23圖為根據本發明一實施例之組態快閃記憶體模組124的方法的流程圖。在步驟2300中,流程開始,且主裝置110、快閃記憶體控制器122與快閃記憶體模組124已完成相關的初始化操作。在步驟2302,主裝置110透過發送一個設定指令集以將快閃記憶體模組124的至少一部份設定為區域命名空間,在以下的說明中,係以區域命名空間310_1來做為說明,例如,主裝置110對儲存裝置120_1設定區域命名空間310_1中每個區域的大小、區域數量、邏輯區塊位址大小等基本設定,例如利用區域命名空間指令集(Zoned Namespaces Command Set)進行設定。在步驟2304中,快閃記憶體控制器122中的微處理器212根據主裝置110所設定之區域的資料量大小(Zone size)、以及快閃記憶體模組124中每一個區塊(實體區塊)的大小,來決定出一個超級區塊所包含之區塊的數量。具體來說,假設主裝置110所設定之區域的資料量大小為A、快閃記憶體模組124中每一個實體區塊中用來儲存主機所用的資料量大小為B,微處理器212以A除以B後所得到的餘數若不為零,則A除以B後所得到的商數加上一,即可為一個超級區塊所包含之區塊的數量。而若微處理器212以A除以B後所得到的餘數為零,則A除以B後所得到的商數,即可為一個超級區塊所包含之區塊的數量。以第24圖所例來說明,快閃記憶體模組124包含了多個快閃記憶體晶片2410、2420、2430、2440,其中快閃記憶體晶片2410包含了兩個資料面2412、2414,快閃記憶體晶片2420包含了兩個資料面2422、2424,快閃記憶體晶片2430包含了兩個資料面2432、2434,快閃記憶體晶片2440包含了兩個資料面2442、2444,且每一個資料面均包含了多個區塊B0~BN,若是A除以B後的商數為‘5’餘數為’3’,則微處理器212可以決定出一個超級區塊包含六個區塊,因此,快閃記憶體控制器122在組態或初始化區域命名空間310_1的過程中,會將資料面2412、2414、2422、2424、2432、2434的第一個區塊B0組態為一超級區塊2461、資料面2412、2414、2422、2424、2432、2434的第二個區塊B1組態為一超級區塊2462、…、以此類推。此外,資料面2442以及資料面2444的區塊B0~BN則可以不需要組態為超級區塊,或是可以另外組成一個獨立於資料面2412、2414、2422、2424、2432、2434的超級區塊。在另一實施例中,快閃記憶體控制器122在組態或初始化區域命名空間310_1的過程中,會將資料面2412、2414、2422、2424、2432、2434的第一個區塊B0組態為一超級區塊2461、資料面2422、2424、2432、2434、2442、2444、的第二個區塊B1組態為一超級區塊2462。只要能使同一超級區塊中的各個區塊平行的進行存取,即可提昇超級區塊存取速度。因此可以在符合此概念之下,任意地進行超級區塊的設定。FIG. 23 is a flowchart of a method of configuring the flash memory module 124 according to an embodiment of the present invention. In step 2300, the process starts, and the main device 110, the flash memory controller 122 and the flash memory module 124 have completed related initialization operations. In step 2302, the host device 110 sets at least a part of the flash memory module 124 as a region namespace by sending a setting command set. In the following description, the region namespace 310_1 is used as an explanation. For example, the host device 110 sets basic settings such as the size, number of regions, and logical block address size of each zone in the zone namespace 310_1 on the storage device 120_1, for example, using a Zoned Namespaces Command Set. In step 2304, the microprocessor 212 in the flash memory controller 122 determines the data size of the zone (Zone size) set by the host device 110, and each block (physical block) in the flash memory module 124. block) to determine the number of blocks contained in a super block. Specifically, it is assumed that the data size of the area set by the main device 110 is A, the data size used by the host in each physical block in the flash memory module 124 is B, and the microprocessor 212 uses If the remainder obtained after A is divided by B is not zero, then the quotient obtained after A is divided by B plus one is the number of blocks contained in a super block. And if the remainder obtained by the microprocessor 212 after dividing A by B is zero, then the quotient obtained after dividing A by B can be the number of blocks included in a super block. Taking the example in Figure 24 as an example, the flash memory module 124 includes a plurality of flash memory chips 2410, 2420, 2430, and 2440. The flash memory chip 2410 includes two data planes 2412 and 2414. The flash memory chip 2420 includes two data planes 2422 and 2424, the flash memory chip 2430 includes two data planes 2432 and 2434, and the flash memory chip 2440 includes two data planes 2442 and 2444, and each Each data plane contains multiple blocks B0~BN. If the quotient of A divided by B is '5' and the remainder is '3', the microprocessor 212 can determine that a super block contains six blocks. , therefore, in the process of configuring or initializing the area namespace 310_1, the flash memory controller 122 will configure the first block B0 of the data plane 2412, 2414, 2422, 2424, 2432, 2434 as a super Block 2461, the second block B1 of data planes 2412, 2414, 2422, 2424, 2432, 2434 are configured as a super block 2462,..., and so on. In addition, the blocks B0~BN of data plane 2442 and data plane 2444 do not need to be configured as super blocks, or they can form an additional super area independent of data planes 2412, 2414, 2422, 2424, 2432, and 2434. block. In another embodiment, during the process of configuring or initializing the region namespace 310_1, the flash memory controller 122 groups the first block B0 of the data planes 2412, 2414, 2422, 2424, 2432, and 2434. The second block B1 is configured as a super block 2461, and the data planes 2422, 2424, 2432, 2434, 2442, 2444 are configured as a super block 2462. As long as each block in the same super block can be accessed in parallel, the super block access speed can be improved. Therefore, the super block can be set arbitrarily while complying with this concept.

在另一實施例中,假設主裝置110所設定之區域的資料量大小為C、快閃記憶體模組124中每一個實體區塊中用來儲存主機所用的資料量大小為D,若是C除以D後的商數為‘3’餘數為’2’, 則微處理器212可以決定出一個超級區塊包含4個區塊,即商數加一。快閃記憶體控制器122在接收到主裝置設定區域命名空間310_1的命令之後,將資料面2412、2414、2422、2424的第一個區塊B0組態為一超級區塊2461,而將2432、2434、2442、2444的第一個區塊B0組態為一超級區塊2462,以此類推。In another embodiment, assume that the data size of the area set by the host device 110 is C, and the data size used by the host in each physical block of the flash memory module 124 is D. If C The quotient after dividing by D is '3' and the remainder is '2', then the microprocessor 212 can determine that a super block contains 4 blocks, that is, the quotient is plus one. After receiving the command from the master device to set the area namespace 310_1, the flash memory controller 122 configures the first block B0 of the data planes 2412, 2414, 2422, and 2424 as a super block 2461, and 2432 , 2434, 2442, and the first block B0 of 2444 are configured as a super block 2462, and so on.

請注意到,儲存裝置120_1、儲存裝置120_2……儲存裝置120_N等在進行出廠前的初始化設定時可以對快閃記憶體模組進行初步的超級區塊設定。以儲存裝置120_1為例,此時的超級區塊設定可以將可同時存取的資料面2412、2414、2422、2424、2432、2434、2442、2444的第一個區塊B0組態為一超級區塊2461,將可同時存取的資料面2412、2414、2422、2424、2432、2434、2442、2444的第二個區塊B1組態為一超級區塊2462,以取得最大存取頻寬。而在儲存裝置120_1與主裝置110連結,並得到主裝置110對於區域命名空間的命令(例如設定區域命名空間310_1)之後,再針對區域命名空間的大小,於快閃記憶體模組124內劃定一特定儲存區域作為區域命名空間310_1的專用空間,且基於主裝置110對區域命名空間310_1的每個區域大小的設定,重新設定該特定儲存空間的超級區塊的大小與結合方式。例如,將資料面2412、2414、2422、2424的第一個區塊B0組態為一超級區塊2461,而將2432、2434、2442、2444的第一個區塊B0組態為一超級區塊2462,以此類推。此時儲存裝置120_1中將有兩種不同大小的超級區塊,專屬於區域命名空間310_1的特定儲存區域之超級區塊設定,將與非專屬於區域命名空間310_1的特定儲存區域之超級區塊設定方式不同。而且,專屬於區域命名空間310_1的特定儲存區域之超級區塊設定也與儲存裝置120_1在進行出廠前的初始化設定不同。Please note that the storage device 120_1, the storage device 120_2... the storage device 120_N, etc. can perform preliminary super block settings on the flash memory module when performing initialization settings before leaving the factory. Taking the storage device 120_1 as an example, the super block setting at this time can configure the first block B0 of the data planes 2412, 2414, 2422, 2424, 2432, 2434, 2442, and 2444 that can be accessed simultaneously as a super block. Block 2461 configures the second block B1 of the data planes 2412, 2414, 2422, 2424, 2432, 2434, 2442, and 2444 as a super block 2462 to obtain the maximum access bandwidth. . After the storage device 120_1 is connected to the host device 110 and obtains the command for the region namespace from the host device 110 (for example, setting the region namespace 310_1), the size of the region namespace is allocated in the flash memory module 124. A specific storage area is defined as a dedicated space of the area name space 310_1, and based on the setting of the size of each area of the area name space 310_1 by the main device 110, the size and combination method of the super block of the specific storage space are reset. For example, the first block B0 of the data planes 2412, 2414, 2422, and 2424 is configured as a super block 2461, and the first block B0 of the data planes 2432, 2434, 2442, and 2444 is configured as a super area. Block 2462, and so on. At this time, there will be two super blocks of different sizes in the storage device 120_1. The super block setting of the specific storage area exclusive to the area namespace 310_1 will be different from the super block setting of the specific storage area not exclusive to the area namespace 310_1. The settings are different. Moreover, the super block setting of the specific storage area dedicated to the area namespace 310_1 is also different from the initialization setting of the storage device 120_1 before leaving the factory.

如上所述,透過根據主裝置110所設定之區域的資料量來決定出超級區塊所包含的區塊數量,讓超級區塊達到最佳的空間利用。As mentioned above, the number of blocks included in the super block is determined according to the data amount of the area set by the main device 110, so that the super block can achieve optimal space utilization.

需注意的是,在第22、24圖的實施例中所述之快閃記憶體晶片的數量、每一個快閃記憶體晶片所包含的資料面數量僅是作為範例說明,而非是本發明的限制。此外,在第22、24圖的實施例中,區域命名空間310_1所包含之快閃記憶體晶片2410、2420、2430、2440與一般儲存空間320_1則包含之快閃記憶體晶片2210、2220、2230、2240可以進行整合。具體來說,快閃記憶體模組124可以僅包含四個快閃記憶體晶片2210、2220、2230、2240,而快閃記憶體晶片2210、2220、2230、2240整體來說包含了第3圖所示的區域命名空間310_1以及一般儲存空間320_1,因此,微處理器212可以將四個快閃記憶體晶片2210、2220、2230、2240組態為同時包含多種具有不同區塊數量的超級區塊,例如,包含了第22圖所示之包含八個區塊的超級區塊以及第24圖所示之包含六個區塊的超級區塊。It should be noted that the number of flash memory chips and the number of data areas included in each flash memory chip in the embodiments of Figures 22 and 24 are only used as examples and are not part of the present invention. limits. In addition, in the embodiments of Figures 22 and 24, the flash memory chips 2410, 2420, 2430, 2440 included in the regional namespace 310_1 and the flash memory chips 2210, 2220, 2230 included in the general storage space 320_1 , 2240 can be integrated. Specifically, the flash memory module 124 may only include four flash memory chips 2210, 2220, 2230, and 2240, and the flash memory chips 2210, 2220, 2230, and 2240 as a whole include the components shown in Figure 3 The area namespace 310_1 and the general storage space 320_1 are shown. Therefore, the microprocessor 212 can configure the four flash memory chips 2210, 2220, 2230, 2240 to simultaneously contain a variety of super blocks with different block numbers. , for example, includes a super block containing eight blocks as shown in Figure 22 and a super block containing six blocks as shown in Figure 24.

另一方面,第3圖所示之一般儲存空間320_1也可以在後續的時間點被主裝置110組態為區域命名空間,而此時一般儲存空間320_1內先前所組態的超級區塊的大小便會需要變更。詳細來說,在第一時間點,微處理器會對一般儲存空間320_1進行設定以規劃出每一個超級區塊的大小,以第22圖為例,由於超級區塊最多能包含八個區塊,故微處理器212設定每一個超級區塊包含八個區塊。接著,若是主裝置110將一般儲存空間320_1重新設定為區域命名空間,則微處理器212需要重新設定其中每一個超級區塊所包含之區塊的數量,例如第22圖所示之六個區塊。On the other hand, the general storage space 320_1 shown in Figure 3 can also be configured as a regional namespace by the host device 110 at a subsequent point in time, and at this time, the size of the previously configured super block in the general storage space 320_1 Changes will be required. Specifically, at the first point in time, the microprocessor will set the general storage space 320_1 to plan the size of each super block. Taking Figure 22 as an example, since a super block can contain up to eight blocks , so the microprocessor 212 sets each super block to include eight blocks. Next, if the main device 110 resets the general storage space 320_1 as a region namespace, the microprocessor 212 needs to reset the number of blocks included in each super block, such as the six regions shown in Figure 22 block.

請注意到,快閃記憶體控制器122為了提高存取速度,通常可以將主裝置110所欲存入儲存裝置120_1的資料先暫存在快閃記憶體模組124的單層儲存記憶體細胞中,或者說以SLC的儲存方式暫存在快閃記憶體模組124中,而最後仍會將該些資料儲存至多層儲存記憶體細胞中,或者說以MLC的儲存方式儲存在快閃記憶體模組124中。本發明之實施例中省略了將該些資料以SLC的儲存方式儲存在快閃記憶體模組124中的過程,直接說明最後以MLC的儲存方式儲存在快閃記憶體模組124中的態樣,熟悉此項技藝者當可在本發明的教導之下,將本發明之技術與將資料以SLC的儲存方式暫存在快閃記憶體模組124中之技術相結合。Please note that in order to increase the access speed, the flash memory controller 122 can usually temporarily store the data that the main device 110 wants to store in the storage device 120_1 in the single-layer storage memory cell of the flash memory module 124. , or in other words, it is temporarily stored in the flash memory module 124 in the SLC storage method, and finally the data will be stored in the multi-layer storage memory cells, or in other words, it is stored in the flash memory module in the MLC storage method. In group 124. In the embodiment of the present invention, the process of storing the data in the flash memory module 124 in the SLC storage mode is omitted, and the final state of storing the data in the flash memory module 124 in the MLC storage mode is directly explained. In this way, those familiar with this art can combine the technology of the present invention with the technology of temporarily storing data in the flash memory module 124 in the SLC storage manner under the teaching of the present invention.

簡要歸納本發明,在本發明之應用於快閃記憶體控制器的控制方法中,透過規劃區域資料寫入至快閃記憶體的模式,可以有效地降低L2P映射表的尺寸,以降低緩衝記憶體或是DRAM的負擔;此外,透過根據區域的資料量以及實體區塊的大小來決定超級區塊所包含的區塊數量,可以更有效地利用快閃記憶體模組的空間。 以上所述僅為本發明之較佳實施例,凡依本發明申請專利範圍所做之均等變化與修飾,皆應屬本發明之涵蓋範圍。 To briefly summarize the present invention, in the control method of the present invention applied to a flash memory controller, through the mode of planning area data to be written to the flash memory, the size of the L2P mapping table can be effectively reduced to reduce the buffer memory. memory or DRAM; in addition, by determining the number of blocks contained in a super block based on the amount of data in the area and the size of the physical block, the space of the flash memory module can be used more efficiently. The above are only preferred embodiments of the present invention, and all equivalent changes and modifications made in accordance with the patentable scope of the present invention shall fall within the scope of the present invention.

100:電子裝置 110:主裝置 120_1, 120_2, 120_N:儲存裝置 122:快閃記憶體控制器 124:快閃記憶體模組 212:微處理器 212C:程式碼 212M:唯讀記憶體 214:控制邏輯 216:緩衝記憶體 218:介面邏輯 232:編碼器 234:解碼器 240:動態隨機存取記憶體 200:區塊 BL1, BL2, BL3:位元線 WL0~WL2, WL4~WL6:字元線 310_1, 310_2:區域命名空間 320_1, 320_2:一般儲存空間 Z0, Z1, Z2, Z3:區域 LBA_k~LBA_(k+x-1):邏輯位址 500~508:步驟 B3, B7, B8, B12, B99, B6:區塊 P1~PM:資料頁 700, 710, 720, 730:L2P映射表 800~806:步驟 900~906:步驟 1100A, 1100B:L2P映射表 1130A, 1130B:共用區塊表 1230:共用區塊表 1300~1306:步驟 1400~1408:步驟 B20, B30, B35:區塊 1600:L2P映射表 1700~1706:步驟 1800~1806:步驟 2000:L2P映射表 2100~2106:步驟 2210, 2220, 2230, 2240:快閃記憶體晶片 2212, 2214, 2222, 2224, 2232, 2234, 2242, 2244:資料面 2261, 2262:超級區塊 2300~2306:步驟 2412, 2414, 2422, 2424, 2432, 2434, 2442, 2444:資料面 2461, 2462:超級區塊 100: Electronic devices 110: Main device 120_1, 120_2, 120_N: storage device 122:Flash memory controller 124:Flash memory module 212:Microprocessor 212C:Program code 212M: read-only memory 214:Control logic 216: Buffer memory 218:Interface logic 232:Encoder 234:Decoder 240:Dynamic Random Access Memory 200:block BL1, BL2, BL3: bit lines WL0~WL2, WL4~WL6: character lines 310_1, 310_2: Region namespace 320_1, 320_2: General storage space Z0, Z1, Z2, Z3: Area LBA_k~LBA_(k+x-1): logical address 500~508: steps B3, B7, B8, B12, B99, B6: block P1~PM:Information page 700, 710, 720, 730:L2P mapping table 800~806: steps 900~906: steps 1100A, 1100B:L2P mapping table 1130A, 1130B: Shared block table 1230: Shared block table 1300~1306: steps 1400~1408: steps B20, B30, B35: block 1600:L2P mapping table 1700~1706: steps 1800~1806: steps 2000:L2P mapping table 2100~2106: steps 2210, 2220, 2230, 2240: Flash memory chip 2212, 2214, 2222, 2224, 2232, 2234, 2242, 2244: Data surface 2261, 2262: super block 2300~2306: Steps 2412, 2414, 2422, 2424, 2432, 2434, 2442, 2444: Data surface 2461, 2462: super block

第1圖為根據本發明一實施例之電子裝置的示意圖。 第2A圖為依據本發明一實施例之儲存裝置內的快閃記憶體控制器的示意圖。 第2B圖為依據本發明一實施例之快閃記憶體模組中一區塊的示意圖。 第3圖為快閃記憶體模組包含一般儲存空間以及區域命名空間的示意圖。 第4圖為區域命名空間被劃分為多個區域的示意圖。 第5圖為根據本發明一實施例之將來自主裝置的資料寫入至區域命名空間的流程圖。 第6圖為區域的資料寫入至快閃記憶體模組內之區塊的示意圖。 第7A圖為本發明一實施例之L2P映射表的示意圖。 第7B圖為本發明另一實施例之L2P映射表的示意圖。 第7C圖為本發明另一實施例之L2P映射表的示意圖。 第7D圖為本發明另一實施例之L2P映射表的示意圖。 第8圖為根據本發明一實施例之自區域命名空間讀取資料的流程圖。 第9圖為根據本發明另一實施例之將來自主裝置的資料寫入至區域命名空間的流程圖。 第10圖為區域的資料寫入至快閃記憶體模組內之區塊的示意圖。 第11A圖為根據本發明一實施例之L2P映射表與共用區塊表的示意圖。 第11B圖為根據本發明一實施例之L2P映射表與共用區塊表的示意圖。 第12圖為根據本發明另一實施例之共用區塊表的示意圖。 第13圖為根據本發明一實施例之自區域命名空間讀取資料的流程圖。 第14圖為根據本發明另一實施例之將來自主裝置的資料寫入至區域命名空間的流程圖。 第15圖為區域的資料寫入至快閃記憶體模組內之區塊的示意圖。 第16圖為根據本發明一實施例之L2P映射表的示意圖。 第17圖為根據本發明另一實施例之自區域命名空間讀取資料的流程圖。 第18圖為根據本發明另一實施例之將來自主裝置的資料寫入至區域命名空間的流程圖。 第19圖為區域的資料寫入至快閃記憶體模組內之區塊的示意圖。 第20圖為根據本發明一實施例之L2P映射表的示意圖。 第21圖為根據本發明一實施例之自區域命名空間讀取資料的流程圖。 第22圖為一般儲存空間內之超級區塊的示意圖。 第23圖為根據本發明一實施例之組態快閃記憶體模組的方法的流程圖。 第24圖為區域命名空間內之超級區塊的示意圖。 第25圖為根據本發明一實施例之應用於一快閃記憶體控制器的控制方法的流程圖。 Figure 1 is a schematic diagram of an electronic device according to an embodiment of the present invention. Figure 2A is a schematic diagram of a flash memory controller in a storage device according to an embodiment of the present invention. Figure 2B is a schematic diagram of a block in a flash memory module according to an embodiment of the present invention. Figure 3 is a schematic diagram of a flash memory module including a general storage space and a regional namespace. Figure 4 is a schematic diagram of the regional namespace being divided into multiple regions. Figure 5 is a flowchart of writing data from a master device into a regional namespace according to an embodiment of the present invention. Figure 6 is a schematic diagram of area data being written to a block in a flash memory module. Figure 7A is a schematic diagram of an L2P mapping table according to an embodiment of the present invention. Figure 7B is a schematic diagram of an L2P mapping table according to another embodiment of the present invention. Figure 7C is a schematic diagram of an L2P mapping table according to another embodiment of the present invention. Figure 7D is a schematic diagram of an L2P mapping table according to another embodiment of the present invention. Figure 8 is a flow chart of reading data from a regional namespace according to an embodiment of the present invention. Figure 9 is a flowchart of writing data from a master device to a regional namespace according to another embodiment of the present invention. Figure 10 is a schematic diagram of area data being written to a block in a flash memory module. Figure 11A is a schematic diagram of an L2P mapping table and a shared block table according to an embodiment of the present invention. Figure 11B is a schematic diagram of an L2P mapping table and a shared block table according to an embodiment of the present invention. Figure 12 is a schematic diagram of a shared block table according to another embodiment of the present invention. Figure 13 is a flow chart of reading data from a regional namespace according to an embodiment of the present invention. Figure 14 is a flowchart of writing data from a master device to a regional namespace according to another embodiment of the present invention. Figure 15 is a schematic diagram of area data being written to a block in a flash memory module. Figure 16 is a schematic diagram of an L2P mapping table according to an embodiment of the present invention. Figure 17 is a flow chart of reading data from a regional namespace according to another embodiment of the present invention. Figure 18 is a flowchart of writing data from the master device to the regional namespace according to another embodiment of the present invention. Figure 19 is a schematic diagram of area data being written to a block in a flash memory module. Figure 20 is a schematic diagram of an L2P mapping table according to an embodiment of the present invention. Figure 21 is a flow chart of reading data from a regional namespace according to an embodiment of the present invention. Figure 22 is a schematic diagram of a super block in a general storage space. Figure 23 is a flow chart of a method of configuring a flash memory module according to an embodiment of the present invention. Figure 24 is a schematic diagram of a super block within a zone namespace. Figure 25 is a flowchart of a control method applied to a flash memory controller according to an embodiment of the present invention.

100:電子裝置 110:主裝置 120_1, 120_2, 120_N:儲存裝置 122:快閃記憶體控制器 124:快閃記憶體模組 100: Electronic devices 110: Main device 120_1, 120_2, 120_N: storage device 122:Flash memory controller 124:Flash memory module

Claims (9)

一種應用於一快閃記憶體控制器的控制方法,其中該快閃記憶體控制器用以存取一快閃記憶體模組,該快閃記憶體模組包含了多個資料面,每一個資料面包含了多個區塊,且每一個區塊包含了多個資料頁,以及該控制方法包含有: 接收來自一主裝置的設定指令,其中該設定指令係將快閃記憶體模組的至少一部份設定為一區域命名空間(zoned namespace),其中該區域命名空間係邏輯性地包含多個區域(zone),該主裝置對於該區域命名空間的資料寫入存取必須要以區域為單位來進行,每一個區域的大小都是相同的,每一個區域內所對應到的邏輯位址必須要是連續的,且區域之間不會有重疊的邏輯位址; 對該區域命名空間進行組態以規劃出多個第一超級區塊,其中每一個第一超級區塊包含了分別位於至少兩個資料面內的多個區塊,且每一個第一超級區塊所包含之區塊的數量是根據每一個區域的大小以及每一個區塊的大小所決定的; 接收來自該主裝置之對應至一特定區域的資料,其中該資料為該特定區域的所有資料;以及 根據該資料之邏輯位址的順序,以依序將該資料寫入至該快閃記憶體模組之該多個第一超級區塊中的一特定第一超級區塊中; 其中就儲存來自該主裝置的資料的角度來看,單一個第一超級區塊只會儲存單一個區域的資料。 A control method applied to a flash memory controller, wherein the flash memory controller is used to access a flash memory module, the flash memory module includes multiple data planes, each data The surface contains multiple blocks, and each block contains multiple data pages, and the control method includes: Receive a setting command from a host device, wherein the setting command sets at least a portion of the flash memory module as a zoned namespace, wherein the zoned namespace logically includes multiple zones (zone), the master device must write and access data in the zone namespace in units of zones. The size of each zone is the same, and the logical address corresponding to each zone must be Continuous, and there will be no overlapping logical addresses between areas; Configure the area namespace to plan a plurality of first super blocks, where each first super block includes a plurality of blocks located in at least two data planes, and each first super block The number of blocks contained in a block is determined by the size of each area and the size of each block; Receive data from the host device corresponding to a specific area, where the data is all data in the specific area; and sequentially writing the data into a specific first super block among the plurality of first super blocks of the flash memory module according to the order of the logical addresses of the data; From the perspective of storing data from the main device, a single first super block will only store data in a single area. 如申請專利範圍第1項所述之控制方法,另包含有: 將該快閃記憶體模組的另一部分設定為一一般儲存空間;以及 對該一般儲存空間進行組態以規劃出多個第二超級區塊,其中每一個第二超級區塊包含了分別該多個資料面的多個區塊。 The control method described in item 1 of the patent application also includes: Setting another part of the flash memory module as a general storage space; and The general storage space is configured to plan a plurality of second super blocks, where each second super block includes a plurality of blocks respectively of the plurality of data planes. 如申請專利範圍第1項所述之控制方法,其中每一個第一超級區塊所包含之區塊的數量不同於每一個第二超級區塊所包含之區塊的數量。For the control method described in Item 1 of the patent application, the number of blocks included in each first super block is different from the number of blocks included in each second super block. 一種快閃記憶體控制器,其中該快閃記憶體控制器係用來存取一快閃記憶體模組,該快閃記憶體模組包含了多個資料面,每一個資料面包含了多個區塊,且每一個區塊包含了多個資料頁,且該快閃記憶體控制器包含有: 一唯讀記憶體,用來儲存一程式碼; 一微處理器,用來執行該程式碼以控制對該快閃記憶體模組之存取;以及 一緩衝記憶體; 其中該微處理器接收來自一主裝置的設定指令,其中該設定指令係將快閃記憶體模組的至少一部份設定為一區域命名空間(zoned namespace),其中該區域命名空間係邏輯性地包含多個區域(zone),該主裝置對於該區域命名空間的資料寫入存取必須要以區域為單位來進行,每一個區域的大小都是相同的,每一個區域內所對應到的邏輯位址必須要是連續的,且區域之間不會有重疊的邏輯位址; 其中該微處理器對該區域命名空間進行組態以規劃出多個第一超級區塊,其中每一個第一超級區塊包含了分別位於至少兩個資料面內的多個區塊,且每一個第一超級區塊所包含之區塊的數量是根據每一個區域的大小以及每一個區塊的大小所決定的;該微處理器接收來自該主裝置之對應至一特定區域的資料,其中該資料為該特定區域的所有資料,且該微處理器根據該資料之邏輯位址的順序,以依序將該資料寫入至該快閃記憶體模組之該多個第一超級區塊中的一特定第一超級區塊中; 其中就儲存來自該主裝置的資料的角度來看,單一個第一超級區塊只會儲存單一個區域的資料。 A flash memory controller, wherein the flash memory controller is used to access a flash memory module. The flash memory module includes multiple data planes, and each data plane includes multiple data planes. blocks, and each block contains multiple data pages, and the flash memory controller includes: A read-only memory used to store a program code; a microprocessor for executing the program code to control access to the flash memory module; and a buffer memory; The microprocessor receives a setting command from a host device, wherein the setting command sets at least a portion of the flash memory module to a zoned namespace, wherein the zoned namespace is logical The ground contains multiple zones (zones). The master device must write and access data in the zone namespace in units of zones. The size of each zone is the same, and the corresponding Logical addresses must be continuous, and there will be no overlapping logical addresses between regions; The microprocessor configures the area namespace to plan a plurality of first super blocks, where each first super block includes a plurality of blocks located in at least two data planes, and each first super block The number of blocks included in a first super block is determined based on the size of each area and the size of each block; the microprocessor receives data corresponding to a specific area from the main device, where The data is all the data in the specific area, and the microprocessor sequentially writes the data to the first super blocks of the flash memory module according to the order of the logical addresses of the data. In a specific first super block in; From the perspective of storing data from the main device, a single first super block will only store data in a single area. 如申請專利範圍第4項所述之快閃記憶體控制器,其中該微處理器將該快閃記憶體模組的另一部分設定為一一般儲存空間,且對該一般儲存空間進行組態以規劃出多個第二超級區塊,其中每一個第二超級區塊包含了分別該多個資料面的多個區塊。The flash memory controller as described in item 4 of the patent application, wherein the microprocessor sets another part of the flash memory module as a general storage space, and configures the general storage space to A plurality of second super blocks are planned, where each second super block includes a plurality of blocks respectively of the plurality of data planes. 如申請專利範圍第5項所述之快閃記憶體控制器,其中每一個第一超級區塊所包含之區塊的數量不同於每一個第二超級區塊所包含之區塊的數量。In the flash memory controller described in claim 5 of the patent application, the number of blocks included in each first super block is different from the number of blocks included in each second super block. 一種儲存裝置,包含有: 一快閃記憶體模組,其中該快閃記憶體模組包含了多個資料面,每一個資料面包含了多個區塊,且每一個區塊包含了多個資料頁;以及 一快閃記憶體控制器,用以存取該快閃記憶體模組; 其中該快閃記憶體控制器接收來自一主裝置的設定指令,其中該設定指令係將快閃記憶體模組的至少一部份設定為一區域命名空間(zoned namespace),其中該區域命名空間係邏輯性地包含多個區域(zone),該主裝置對於該區域命名空間的資料寫入存取必須要以區域為單位來進行,每一個區域的大小都是相同的,每一個區域內所對應到的邏輯位址必須要是連續的,且區域之間不會有重疊的邏輯位址; 其中該快閃記憶體控制器對該區域命名空間進行組態以規劃出多個第一超級區塊,其中每一個第一超級區塊包含了分別位於至少兩個資料面內的多個區塊,且每一個第一超級區塊所包含之區塊的數量是根據每一個區域的大小以及每一個區塊的大小所決定的;該快閃記憶體控制器接收來自該主裝置之對應至一特定區域的資料,其中該資料為該特定區域的所有資料,且該快閃記憶體控制器根據該資料之邏輯位址的順序,以依序將該資料寫入至該快閃記憶體模組之該多個第一超級區塊中的一特定第一超級區塊中; 其中就儲存來自該主裝置的資料的角度來看,單一個第一超級區塊只會儲存單一個區域的資料。 A storage device including: A flash memory module, wherein the flash memory module includes multiple data planes, each data plane includes multiple blocks, and each block includes multiple data pages; and a flash memory controller for accessing the flash memory module; wherein the flash memory controller receives a setting command from a host device, wherein the setting command sets at least a portion of the flash memory module as a zoned namespace, wherein the zoned namespace The system logically contains multiple zones. The master device must write and access data in the zone namespace in units of zones. The size of each zone is the same, and all data in each zone must be written and accessed. The corresponding logical addresses must be continuous, and there will be no overlapping logical addresses between regions; The flash memory controller configures the area namespace to plan a plurality of first super blocks, where each first super block includes a plurality of blocks located in at least two data planes. , and the number of blocks included in each first super block is determined according to the size of each area and the size of each block; the flash memory controller receives a corresponding message from the main device to a Data in a specific area, where the data is all data in the specific area, and the flash memory controller writes the data to the flash memory module sequentially according to the order of the logical addresses of the data In a specific first super block among the plurality of first super blocks; From the perspective of storing data from the main device, a single first super block will only store data in a single area. 如申請專利範圍第7項所述之儲存裝置,其中該快閃記憶體控制器將該快閃記憶體模組的另一部分設定為一一般儲存空間,且對該一般儲存空間進行組態以規劃出多個第二超級區塊,其中每一個第二超級區塊包含了分別該多個資料面的多個區塊。The storage device as described in Item 7 of the patent application, wherein the flash memory controller sets another part of the flash memory module as a general storage space, and configures the general storage space for planning A plurality of second super blocks are generated, where each second super block includes a plurality of blocks respectively of the plurality of data planes. 如申請專利範圍第8項所述之儲存裝置,其中每一個第一超級區塊所包含之區塊的數量不同於每一個第二超級區塊所包含之區塊的數量。In the storage device described in claim 8 of the patent application, the number of blocks included in each first super block is different from the number of blocks included in each second super block.
TW112121856A 2021-02-23 2021-02-23 Storage device, flash memory control and control method thereo TWI821152B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW112121856A TWI821152B (en) 2021-02-23 2021-02-23 Storage device, flash memory control and control method thereo

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW112121856A TWI821152B (en) 2021-02-23 2021-02-23 Storage device, flash memory control and control method thereo

Publications (2)

Publication Number Publication Date
TW202340964A TW202340964A (en) 2023-10-16
TWI821152B true TWI821152B (en) 2023-11-01

Family

ID=89722312

Family Applications (1)

Application Number Title Priority Date Filing Date
TW112121856A TWI821152B (en) 2021-02-23 2021-02-23 Storage device, flash memory control and control method thereo

Country Status (1)

Country Link
TW (1) TWI821152B (en)

Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW200636465A (en) * 2005-01-07 2006-10-16 Hyperstone Ag Method for converting logical block address into real block address in flash memory
TW200837562A (en) * 2006-09-15 2008-09-16 Sandisk Corp Non-volatile memory and method for class-based update block replacement rules
TW200937429A (en) * 2008-02-13 2009-09-01 Samsung Electronics Co Ltd Multi-channel flash memory system and access method
CN102693758A (en) * 2011-03-22 2012-09-26 群联电子股份有限公司 Data reading method, memory storage device and memory controller
TW201339958A (en) * 2012-03-20 2013-10-01 Phison Electronics Corp Memory controller, memory storage device, and method for writing data
TW201443641A (en) * 2013-01-22 2014-11-16 Lsi Corp Management of and region selection for writes to non-volatile memory
TW201510722A (en) * 2009-09-03 2015-03-16 Pioneer Chip Technology Ltd Page based management of flash storage
TW201818401A (en) * 2016-09-14 2018-05-16 阿里巴巴集團服務有限公司 Method and device for writing stored data into storage medium based on flash memory
TW201915744A (en) * 2017-09-21 2019-04-16 日商東芝記憶體股份有限公司 Memory system and method for controlling nonvolatile memory
TW201915742A (en) * 2017-09-21 2019-04-16 日商東芝記憶體股份有限公司 Memory system and method for controlling nonvolatile memory
TW201915747A (en) * 2017-09-21 2019-04-16 日商東芝記憶體股份有限公司 Memory system and method for controlling nonvolatile memory
TW201918885A (en) * 2017-11-06 2019-05-16 日商東芝記憶體股份有限公司 Memory system and method for controlling nonvolatile memory
TW201941062A (en) * 2018-01-26 2019-10-16 慧榮科技股份有限公司 Method for performing writing management in a memory device, and associated memory device and controller thereof

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW200636465A (en) * 2005-01-07 2006-10-16 Hyperstone Ag Method for converting logical block address into real block address in flash memory
TW200837562A (en) * 2006-09-15 2008-09-16 Sandisk Corp Non-volatile memory and method for class-based update block replacement rules
TW200937429A (en) * 2008-02-13 2009-09-01 Samsung Electronics Co Ltd Multi-channel flash memory system and access method
TW201510722A (en) * 2009-09-03 2015-03-16 Pioneer Chip Technology Ltd Page based management of flash storage
CN102693758A (en) * 2011-03-22 2012-09-26 群联电子股份有限公司 Data reading method, memory storage device and memory controller
TW201339958A (en) * 2012-03-20 2013-10-01 Phison Electronics Corp Memory controller, memory storage device, and method for writing data
TW201443641A (en) * 2013-01-22 2014-11-16 Lsi Corp Management of and region selection for writes to non-volatile memory
TW201818401A (en) * 2016-09-14 2018-05-16 阿里巴巴集團服務有限公司 Method and device for writing stored data into storage medium based on flash memory
TW201915744A (en) * 2017-09-21 2019-04-16 日商東芝記憶體股份有限公司 Memory system and method for controlling nonvolatile memory
TW201915742A (en) * 2017-09-21 2019-04-16 日商東芝記憶體股份有限公司 Memory system and method for controlling nonvolatile memory
TW201915747A (en) * 2017-09-21 2019-04-16 日商東芝記憶體股份有限公司 Memory system and method for controlling nonvolatile memory
TW201918885A (en) * 2017-11-06 2019-05-16 日商東芝記憶體股份有限公司 Memory system and method for controlling nonvolatile memory
TW201941062A (en) * 2018-01-26 2019-10-16 慧榮科技股份有限公司 Method for performing writing management in a memory device, and associated memory device and controller thereof

Also Published As

Publication number Publication date
TW202340964A (en) 2023-10-16

Similar Documents

Publication Publication Date Title
TWI775268B (en) Storage device, flash memory control and control method thereof
TWI828085B (en) Control method of flash memory controller, flash memory controller, and storage device
TWI821151B (en) Control method of flash memory controller, flash memory controller, and storage device
US10977189B2 (en) Reducing forward mapping table size using hashing
TWI808384B (en) Storage device, flash memory control and control method thereo
TWI844891B (en) Storage device, flash memory control and control method thereof
TWI806508B (en) Control method for flash memory controller, flash memory controller, and storage device
TWI821152B (en) Storage device, flash memory control and control method thereo
TWI859853B (en) Control method for flash memory controller, flash memory controller, and storage device
US20240320173A1 (en) Storage device providing direct memory access, computing system including the same, and operating method of the storage device
TW202414400A (en) Method for accessing flash memory module and associated flash memory controller and memory device