200826069 九、發明說明: 【發明所屬之技術領域】 本發明係關於-種儲存系統管理方法,尤其係關於—種儲存 系統之快照設備管理方法。 【先前技術】 基於Lmux系統之邏輯卷管理(LGgleal Vdume Management, LVM)係透過在輸入/輸出(I/O)子系統中增加一個額外層來實現,這 個加在檔案系統和實體磁碟驅動之間之層稱為邏輯卷設備驅動層 〇x)gicalVolUme Device Driver,LVDD)。透過邏輯卷設備驅動層, 上層之檔案系統或其他應用獲得了一個對磁碟或分區虛擬視圖。 請參考「第1圖」,邏輯卷管理在多個同一類型儲存設備(如,硬碟、 RAID没備)上開啟由多個實體區塊(PhySicai Extent,PE) 140組成 之貝體卷(Physical Volume,PV) 120,並將這些實體卷120透過 串聯或者分條(Stripe)之方式組合成卷組(v〇lume Group,VG) 100將卷組100劃分為一個或多個邏輯卷(L〇gicai Volume,LV) 後’就可以如使用/盤符/分區(/disk/partition)—樣使用/設備/卷組名 /邏輯卷名(/device/vg-name/lv-name)來訪問邏輯卷。邏輯卷管理可 以動態地修改儲存空間之大小,其上之資料亦不會丟失,且不需 要重新啟動電腦。 為了保證資料之安全性’邏輯卷管理採用了快照(Snapshot)機 製。快照技術為一種針對包括硬碟、邏輯磁碟等區塊設備的備份 5 200826069 方式,開啟快照的設備稱作原區塊設備,開啟出的快照是與原區 塊設備相關的區塊設備,稱作㈣設備。親塊設備和快照設 備的描述結構都保存在系統隨機存取記憶體(Rand._ss .簡稱Ram)中,快照設備本身也需要使用一定的實體儲 存空間。-般開啟快照時需要指定原區塊設備、快照實際容量大 小以及快照設備本身使用的儲存設備,快照設備的邏輯儲存容量 :為原區塊設備的;M、。快照設備上儲存資料並劃分空_最小單 位為資料區塊(chunk),一般大小為64k。 1¾並不讀原區塊設備儲存之資料之完全備份,而是以資 料區塊為單位對原區塊設備進行齡,直到原區贼備之資料需 要被修改時,才將需要修改之資料區塊之資料複製到快照設備, 一技術被稱為「寫人同步複製(eQpy.write,CC)Wh技彳_。 快照被開啟時會被劃分為多個實體區塊(通常以M為單位), ( 母们員體區塊被劃分為多個資料區塊。每個實體區塊之第一個資 料區塊用以記錄舊資料區塊_ ehunk)和新㈣區塊 之對應關係(即,exception table),其餘資料區塊則用以存放寫入同 步複製資料。 请筝考「第2圖」,電腦啟動時,系統内核讀取硬碟上之 exception table以在記憶體上開啟一個雜凑(hash)表。當接收到用戶 妓之寫人請求(步驟),f要進行寫人同步複製(c〇w燦作 時’首先_是否存在與寫人請求資料區塊相應之快照(步驟 6 200826069 〇2) w不存在快照時 戸舄入凊求(步驟210)。否則,遍 .歷體中之雜凑表(步驟 項涉驟裏)。當在雜凑表中杳找在雜凑表中查找到對應 資料區塊已完成寫人同步㈣/作對應項時,說明此寫入請求之 專否則,進行寫入同繼續發送寫入請求(步驟 ., 夂衣紅作(步驟2〇8),然後繼續發送寫 入請求(步驟210)。 、馬 因此習知技術的主要缺點如下·· 1.每修改-次資料區塊,就需要進行—次寫人同 同步複製操作制了同步輪入/輸_)操作,即= 寺此舄入彳祕絲,系統才會進行後蚊操作。因此,當有大旦 寫入請求發生時,寫人畔複製賴料致A量切 : 作,極大地降低了系統效能。 2·快照開啟後,資料區塊之大小不可以 ^ 夂如果貧料區 設置過小’在處理大容量寫人請树會大量輪人/輪出操 極大降低系統效能;反之,在處理小容量寫入請求時會導f、, 空間之浪費,並降低系統處理速度。 、致磁碟 【發明内容】 為了解決上述習知技術中的問題與缺陷,本發明之目、 提供一種自動調整快照設備之寫入同步複製磁碟空間大、在於 法。 ’、之方 7 200826069 本發明所提供之-種自動調整快照設備之寫人同步複製磁碟 空間大小之方法,係包含以下步驟: a) 啟始化—個快照設備之一個第—磁碟空間,對第一磁碟空間 之資料區塊進行寫入同步複製操作; b) 判斷-個寫入請求之資料區塊序號是否位於第一磁碟空間; 0當寫入請求之資料區塊序號位於第—麵空間時,繼續維護 第一磁碟空間;以及 d)當寫入請求之資料區塊序號不位於第—磁碟空間時,啟始化 -個第二磁碟空間,此第二磁碟空間之龍區塊數目與第一磁碟 空間中最大連續資料區塊數目相同,並對第二磁碟空間之資料區 塊進行寫入同步複製操作。 其中第一磁碟空間之資料結構包含:起始序號資料變數、當 前起始序號倾魏、當前最後賴麵魏、#前最大數資^ 變數以及最大數資料變數。 其中第一磁碟空間之起始序號之啟始值為〇,當前起始序號之 啟始值為0 ’當^袁後序號之啟始值為〇,當前最大數之啟始值為 1,最大數之啟始值為1。 其中步驟b)進-步包含:計算出第一磁碟空間之起始序號之 值與最大數之值相加之結果;判斷寫入請求之資料區塊序號是否 大於此結果。 8 200826069 其中步驟C)進一步包含:判斷寫入請求之資料區塊序號是否 等於第一磁碟空間之當前最後序號之值加1;當寫入請求之資料區 塊序號等於第一磁碟空間之當前最後序號之值加1時,將第一磁 碟空間之當前最後序號之值加1 ;以及否則,計算出第一磁碟空間 之當前最後序號之值減去當前起始序號之值之結果,將此結果與 第一磁碟空間之當前最大數之值中較大值賦值給第一磁碟空間之 當别隶大數’並將寫入請求之資料區塊序號賦值該第一磁碟空間 之當前起始序號和當前最後序號。 其中第二磁碟空間之資料結構與第一磁碟空間之資料結構相 同。 其中步驟d)進一步包含:判斷寫入請求之資料區塊序號是否 等於第一磁碟空間之當前最後序號之值加丨;當寫入請求之資料區 塊序號等於第一磁碟空間之當前最後序號之值加i時,將第一磁 碟空間之當前最後序號之值加1,並對第一磁碟空間之當前最後序 號之值對應之資料區塊進行寫入同步複製操作;否則,將寫入請 求之資料區塊序號賦值給第二磁碟空間之起始序號、當前起始序 號以及當前最後序號,計算出第一磁碟空間之當前最後序號之值 減去當前起始序號之值之結果,將此結果與第_磁碟空間之當前 最大數之值中較大值賦值給第二磁碟空間之最大數;以及從第二 磁碟空間之起始序號之值對應之資料區塊開始,對與第二磁碟空 間之最大數之值_數量之⑽區塊進行寫人同步複製操作。 9 200826069 =職’本發明可以自動調整以同步複製磁碟如之大 ζ連rrt連續之以同步難操作針於—次完成,透過 攻種“、集t、突發式請求,極大提高了系統效能。 【實施方式】 將結合圖式部觸本翻之她實财式料細說明。 弟3圖」和「第4圖」所示係為本發明之自動調整快昭設 備之寫入时複製_郎大小之方法。射,字母A絲干寫 入請求之資料區塊序號大於第—磁碟如之起始序號之值加上最 大數之值時之處理流程。 如「第2圖」所示之習知技術之寫入請求處理之快照處理流 田雜凑表中不存在與舄人請求之資料區塊對應之訊息,需要 K亍舄入同步;^製操作(步驟細)時,即可用本發明以替代習知之 處理方法。 首先,啟始化一個快照設備之第一磁碟空間,對第一磁碟空 間進行寫入同步複製(C0W)操作(步驟3〇〇)。啟始化後之第一磁碟 空間之資料結構包含起始序號資料變數、當前起始序號資料變 數、§#最後序號資料變數、當前最大數資料變數以及最大數資 料變數。例如,採用以下描述之結構: #typedef struct cow writea200826069 IX. Description of the Invention: [Technical Field] The present invention relates to a storage system management method, and more particularly to a snapshot device management method for a storage system. [Prior Art] LGgleal Vdume Management (LVM) based on Lmux system is implemented by adding an additional layer to the input/output (I/O) subsystem, which is added to the file system and the physical disk drive. The layer between them is called the logical volume device driver layer 〇 x) gicalVolUme Device Driver, LVDD). Through the logical volume device driver layer, the upper file system or other application obtains a virtual view of the disk or partition. Please refer to Figure 1 for logical volume management to open a shell volume consisting of multiple physical blocks (PhySicai Extent, PE) 140 on multiple storage devices of the same type (for example, hard disk and RAID). Volume, PV) 120, and these physical volumes 120 are combined into a volume group (VG) by way of series or stripe (divide) to divide the volume group 100 into one or more logical volumes (L〇 Gicai Volume, LV) After 'can use / drive / partition (/disk / partition) - use / device / volume group name / logical volume name (/device / vg-name / lv-name) to access the logic volume. Logical volume management can dynamically modify the size of the storage space, the data on it will not be lost, and there is no need to restart the computer. In order to ensure the security of the data, the logical volume management adopts a Snapshot mechanism. The snapshot technology is a backup device for a block device including a hard disk, a logical disk, and the like. The device that starts the snapshot is called the original block device, and the opened snapshot is the block device related to the original block device. (4) Equipment. The description structure of the parent device and the snapshot device are stored in the system random access memory (Rand._ss. Ram), and the snapshot device itself needs to use a certain physical storage space. Generally, you need to specify the original block device, the actual size of the snapshot, and the storage device used by the snapshot device itself. The logical storage capacity of the snapshot device is: the original block device; M,. The snapshot device stores the data and divides the empty_minimum unit into chunks, which are generally 64k. 13⁄4 does not read the full backup of the data stored in the original block device, but the age of the original block device in the data block, until the data of the original thief needs to be modified, the data area that needs to be modified The data of the block is copied to the snapshot device. One technique is called "eQpy.write (CC) Wh technology." When the snapshot is opened, it is divided into multiple physical blocks (usually in M). , ( The parent body block is divided into multiple data blocks. The first data block of each physical block is used to record the correspondence between the old data block _ ehunk) and the new (four) block (ie, Exception table), the rest of the data block is used to store the synchronous copy data. Please test the "Figure 2", when the computer starts, the system kernel reads the exception table on the hard disk to open a hash on the memory. (hash) table. When receiving the user's request for the writer (step), f is to perform the writer's synchronous copy (c〇w), first of all, whether there is a snapshot corresponding to the writer requesting the data block (step 6 200826069 〇 2) w If there is no snapshot, the request is entered (step 210). Otherwise, the hash table in the calendar is used (in the step item). When looking for the corresponding data in the hash table in the hash table When the block has completed the write synchronization (four)/for the corresponding item, it indicates that the write request is special, and the write request is continued with the write request (step., 夂衣红作 (step 2〇8), and then continue to send Write request (step 210). The main shortcomings of the conventional technology are as follows: 1. Each modification-time data block needs to be performed - the same write synchronous copy operation makes the synchronous round input/transmission_) Operation, that is, the temple will break into the secret wire, and the system will perform the post-mosquito operation. Therefore, when there is a large-density write request, the writer will copy the material to the A-cut: the system is greatly reduced. Performance 2. After the snapshot is turned on, the size of the data block cannot be ^ 夂 if the poor material area is set too small 'in the The large capacity writers ask the tree to have a large number of rounds/rounds to greatly reduce the system performance; on the contrary, when dealing with small-capacity write requests, it will lead to f, space waste, and reduce the processing speed of the system. In order to solve the problems and defects in the above-mentioned prior art, the object of the present invention is to provide an automatic adjustment of the snapshot device to write synchronous copy disk space, and the method is as follows. ', the party 7 200826069 The method for automatically adjusting the size of the write copy synchronous disk space of the snapshot device includes the following steps: a) Initiating a first-disk space of the snapshot device, writing the data block of the first disk space Into the synchronous copy operation; b) determine whether the data block number of the write request is located in the first disk space; 0 when the data block number of the write request is located in the first space, continue to maintain the first disk space And d) when the data block number of the write request is not located in the first disk space, the second disk space is initialized, and the number of dragon blocks in the second disk space is first Singles spaces in the same number of maximum continuous data blocks, and the data block of the second region of the disk space write synchronous replication operation. The data structure of the first disk space includes: a starting serial number data variable, a current starting number, a current Wei, a current final number, a maximum number of variables, and a maximum number of data variables. The starting number of the first serial number of the first disk space is 〇, and the starting value of the current starting number is 0'. When the starting number of the serial number is 〇, the starting value of the current maximum number is 1, The maximum number starts with 1. The step b) further comprises: calculating a result of adding the value of the starting sequence number of the first disk space to the value of the maximum number; determining whether the data block number of the write request is greater than the result. 8 200826069 wherein the step C) further comprises: determining whether the data block number of the write request is equal to the value of the current last serial number of the first disk space plus 1; when the data block number of the write request is equal to the first disk space When the value of the last serial number is incremented by 1, the value of the current last serial number of the first disk space is incremented by one; and otherwise, the value of the current last serial number of the first disk space is subtracted from the value of the current starting sequence number. And assigning the result to the larger value of the current maximum number of the first disk space to the first disk space and assigning the data block number of the write request to the first disk The current starting sequence number and the current last sequence number of the space. The data structure of the second disk space is the same as the data structure of the first disk space. The step d) further includes: determining whether the data block number of the write request is equal to the value of the current last serial number of the first disk space; and when the data block number of the write request is equal to the current last of the first disk space When the value of the serial number is increased by i, the value of the current last serial number of the first disk space is incremented by 1, and the data block corresponding to the current last serial value of the first disk space is written into the synchronous copy operation; otherwise, The data block number of the write request is assigned to the start sequence number, the current start sequence number, and the current last sequence number of the second disk space, and the value of the current last sequence number of the first disk space is calculated minus the value of the current start sequence number. As a result, the larger of the value of the current maximum number of the _th disk space is assigned to the maximum number of the second disk space; and the data area corresponding to the value of the starting sequence number of the second disk space At the beginning of the block, a write synchronous copy operation is performed on the (10) block of the maximum number of values of the second disk space. 9 200826069 = job 'The invention can be automatically adjusted to synchronously copy the disk, such as the big r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r [Embodiment] The description will be made in conjunction with the fact that the figure is combined with the real money. The brothers 3 and ” are shown in the figure 4 for the automatic copying of the invention. _ Lang size method. Shooting, the letter A silk is written into the request data block number is greater than the processing flow of the first disk as the starting serial number plus the maximum value. If there is no message corresponding to the data block requested by the deaf person in the snapshot processing flow field hash table of the prior art as shown in the "Fig. 2", the K input synchronization is required; (The steps are fine), the present invention can be used instead of the conventional treatment method. First, the first disk space of a snapshot device is initialized, and a synchronous copy (C0W) operation is performed on the first disk space (step 3). The data structure of the first disk space after initialization includes the starting serial number data variable, the current starting serial number data variable, the §# last serial data variable, the current maximum data variable, and the maximum number of data variables. For example, use the structure described below: #typedef struct cow writea
Int64 〇rg—wind〇w 一 chunk; 10 200826069Int64 〇rg—wind〇w a chunk; 10 200826069
Int tmp—window—org 一 chunk;Int tmp—window—org a chunk;
Int tmp 一window 一 last一 chunk;Int tmp a window a last one chunk;
Int tmp—max一windows;Int tmp—max one windows;
Int last—windows—chunks; } last_cow_writea; 其中,起始序號資料變數(org一window-chunk)係用以表示第/ f' 磁碟空間之第一個資料區塊序號,啟始值為0;當前起始序號資料Int last—windows—chunks; } last_cow_writea; where the starting sequence data variable (org-window-chunk) is used to indicate the first data block number of the /f' disk space, starting at 0; Current starting serial number data
'V 變數(tmp—window一org一chunk)係用以表示第一磁碟空間中正在維 護之連續資料區塊之第一個資料區塊之序號,啟始值為〇;當前最 後序號資料變數(tmp 一window 一 last_chunk)係用以表示正在維護之 連續資料區塊之最後一個資料區塊之序號,即上一次寫入請求之 資料區塊序號’啟始值為0 ;當前最大數資料變數 (tmp一max一windows)係用以表示第一磁碟空間中當前最大連續資 、 料區塊數,啟始值為1 ;最大數資料變數(last_windows_chunksM系 用以表示上一磁碟空間中最大連讀資料區塊數,啟始值為丨,其與 起始序號之值相加即為第一磁碟空間所維護之最大資料區塊序 號。 當接收到用戶發送之寫入請求,需要進行寫入同步複製操作 日守,判斷舄入请求之資料區塊序號是否位於第一磁碟空間,即計 异出第-補空間之^始序號之值與最大數之值相加之結果,並 判斷寫入請求之資料區塊序號是否大於此結果(步驟3〇2)。 11 200826069 當寫入請求之資料區塊序號小於或等於此兩者相加之結果 時,即表明寫入請求之資料區塊序號位於第一磁碟空間。此時, 繼續判斷寫入請求之資料區塊序號是否等於第一磁碟空間之當前 最後序號之值加U步驟304),即判斷寫入請求之資料區塊序號是 否與當前正在維護之連續資料區塊相連續。 當寫入請求之資料區塊序號等於第一磁碟空間之當前最後序 號之值加1時,表明寫入請求之資料區塊序號與第一磁碟空間中 正在維護之連續資料區塊相連續。因為第一磁碟空間在啟始化時 已元成馬入同步複氣4木作’所以僅需要將第'一磁碟空間之當前最 後序號之值加1(步驟306)。 當寫入請求之資料區塊序號不等於第一磁碟空間之當前最後 序號之值加1時,表明寫入請求之資料區塊序號與第一磁碟空間 中正在維護之連續資料區塊不相連續。因此,先計算出第一磁碟 空間之當前最後序號之值減去當前起始序號之值之結果(步驟 3〇8),將此結果與第一磁碟空間之當前最大數之值中較大值賦值给 第一磁碟空間之當前最大數(步驟310),從而更新第一磁碟空間之 當前最大數中儲存之當前最大連續資料區塊數。接著將寫入請求 之資料區塊序號賦值給第一磁碟空間之當前起始序號和當前最後 序唬(步驟312),以在第一磁碟空間開啟另一個連續資料區塊區域。 當舄入請求之資料區塊序號大於第一磁碟空間之起始序號之 值與最大數之值相加之結果時,即表明寫入請求之資料區塊序號 12 200826069 不位於第一磁碟空間。此時,繼續判斷寫入請求之資料區塊序號 是否等於第一磁碟空間之當前最後序號之值加1(步驟400),即判 斷寫入請求之資料&塊序號疋否與當前正在維護之連續資料區塊 相連續。 當寫入請求之資料區塊序號等於第一磁碟空間之當前最後序 號之值加1時,表明寫入請求之資料區塊序號與第一磁碟空間中 正在維護之連續資料區塊相連續。但寫入請求之資料區塊序號不 位於第一磁碟空間,即寫入請求之資料區塊未進行寫入同步複製 操作,所以先將第一磁碟空間之當前最後序號之值加1(步驟 402),接著對第一磁碟空間之當前最後序號之值對應之資料區塊進 行寫入同步複製操作(步驟404),從而擴展了第一磁碟空間之大小。 §寫入清求之^料區塊序5虎不寻於第一磁碟空間之當前最後 序號之值加1時,表明寫入請求之資料區塊序號與第一磁碟空間 中正在維遵之連績負料區塊不相連績’因而需要啟始化^一個第一 磁碟空間。第二磁碟空間之資料結構與第一磁碟空間相同,其啟 始化時資料區塊數目為第一磁碟空間之最大連續資料區塊數目。 在第二磁碟空間啟始化過程時,先將寫入請求之資料區塊序號職 值給第二磁碟空間之起始序號、當前起始序號以及當前最後序號 (步驟406)。接著計算出第一磁碟空間之當前最後序號之值減去當 前起始序號之值之結果(步驟408),將此結果與第一磁碟空間之當 前最大數之值中較大值賦值給第二磁碟空間之最大數(步驟41〇)。 13 200826069 最後,從第二磁碟空間之起始序號之值對應之資料區塊開始,對 與第一磁碟謂之最大數之值相同數目之資料區塊進行寫入同步 複製操作(步驟412)。 由以上描述可知,當寫入請求之資料區塊序號不位於第一磁 碟空間’但與第—磁碟空間之最後序號之值加1相科,即可實 現第一磁碟空間之大小之自動調整。而將第-磁碟空間、第二磁 碟空間之全部簡區塊之寫人同步複製操作集巾於-次完成,則 可以^過龍連續、集巾、突發式請求,極大提高系統效能。 月$考第5圖」’其為第一磁碟空間500在不同時刻之狀態 方塊圖。啟始化後之第—磁碟空間5⑻,其起始序號、當前起始序 號孝田A最後序號均為同—值,即為第—磁碟空間之第一個 貢料區塊之额。而當前最大數之值為起始值1,最大數之值也為 啟始值1 ’即第—磁碟空間500僅包含-個資料區塊。 守J 1之第一磁碟空間5〇〇,包含一個第一連續資料區塊區域 502。此日守,第一磁碟空間5〇〇之起始序號之值沒有變化,而當前 起始序叙值為第—連續資料區塊區域5〇2之第-個資料區塊之 序號田4最後序號之值為第一連續資料區塊區域5〇2之最後一 =貝料區塊之錢,即為上—次寫人請求之資樞塊序號。當前 最大數之值仍為啟始值1。 日守刻2之第一磁碟空間500包含兩個連續資料區塊區域,第 連、、灵貝料區塊區域5〇2和第二連續資料區塊區域5〇4。第一磁碟 14 200826069 空間500之起始序號之值仍沒有變化,為第一磁碟空間5〇〇之第 一個貝料區塊之序號。當前起始序號之值則變為第二連續資料區 塊區域504之第-個資料區塊之序號,#前最後序號之值變為第 二連續資料區塊區域5Q4之最後一個資料區塊之序號,當前最大 數之值為第-連續資料區塊區域5()2之資料區塊數目。 雖然本發明以前述之較佳實施方式揭露如上,然其並非用以 ,限定本H本領域之技術人貞應當意_在不脫離本發明所附 之申μ專彳j範目所揭不之本發明之範圍和精神之情況下,所爲之 更動門飾均屬本發明之專利保護範圍之内。關於本發明所界 定之保護範圍請參考所附之申請專利範圍。 【圖式簡單說明】 第1圖為習知技術之卷組組成結構之方塊圖; 弟2圖為習知技術之寫人請求之快照處理流程圖; 弟3圖和I 4 ϋ為本發明之自動調整快照設備之寫入同步複 製磁碟空間大小之方法流程圖;以及 味固為第磁碟空間在不同時刻之狀態方塊圖。 【主要元件符號說明】 !〇〇卷組 120 實體卷 140 實體區塊 500 15 200826069 502第一連續資料區塊區域 504 第二連續資料區塊區域 步驟200接收用戶發送之寫入請求 步驟202是否有快照 步驟204遍歷記憶體中之雜湊表 步驟206是否找到對應項 步驟208進行寫入同步複製操作 步驟210繼續發送寫入請求 步驟300啟始化一個快照設備之第一磁碟空間,對第_磁碟 空間之資料區塊進行寫入同步複製操作 步驟302寫入請求之資料區塊序號是否大於第一磁碟空間 之起始序號之值加上最大數之值 步驟304寫入請求之資料區塊序號是否等於第一磁碟空間 之當前最後序號之值加1 步驟306將第一磁碟空間之當前最後序號之值加! 步驟308計算出第一磁碟空間之當前最後序號之值減去當 前起始序號之值之結果 步驟310將此結果與第一磁碟空間之當前最大數之值中較 大值賦值給第一磁碟空間之當前最大數 步驟312將寫入請求之資料區塊序號賦值給第一磁碟空間 之當前起始序號和當前最後序號 16 200826069 步驟400寫入請求I資料區塊序號是否等於第一磁碟空間 之當前最後序號之值加1 步驟402將第一磁碟空間之當前最後序號之值加1 步驟4〇4對第一磁碟空間之當前最後序號之值對應之資料 區塊進行寫入同步複製操作 步驟406將寫入請求之資料區塊序號賦值給第二磁碟空間 之起始序號、當前起始序號以及當前最後序號 步驟408計算出第一磁碟空間之當前最後序號之值減去當 前起始序號之值之結果 步驟絲結果與第—磁碟空間之#前最大數之值中較 大值賦值給第二磁碟空間之最大數The 'V variable (tmp_window-org-chunk) is used to indicate the serial number of the first data block of the continuous data block being maintained in the first disk space, the starting value is 〇; the current last serial number data variable (tmp a window a last_chunk) is used to indicate the serial number of the last data block of the continuous data block being maintained, that is, the data block number of the last write request 'start value is 0; the current maximum data variable (tmp-max-windows) is used to indicate the current maximum continuous resource and material block number in the first disk space, the starting value is 1; the maximum number of data variables (last_windows_chunksM is used to represent the largest in the previous disk space) The number of consecutive data blocks, the starting value is 丨, and the value of the starting sequence number is the maximum data block number maintained by the first disk space. When receiving the write request sent by the user, it needs to be performed. Write the synchronous copy operation day-to-day, determine whether the data block number of the intrusion request is located in the first disk space, that is, the result of adding the value of the first serial number of the first complement space to the maximum number, and Judge write request Whether the data block number is greater than the result (step 3〇2). 11 200826069 When the data block number of the write request is less than or equal to the result of the addition of the two, the data block number of the write request is located at the first a disk space. At this time, it is determined whether the data block number of the write request is equal to the value of the current last sequence number of the first disk space plus U step 304), that is, whether the data block number of the write request is current or not The continuous data blocks being maintained are continuous. When the data block number of the write request is equal to the value of the current last serial number of the first disk space plus one, it indicates that the data block number of the write request is continuous with the continuous data block being maintained in the first disk space. . Since the first disk space has become a synchronous anneal when it is initialized, it is only necessary to add 1 to the value of the current last number of the first disk space (step 306). When the data block number of the write request is not equal to the value of the current last serial number of the first disk space plus 1, the data block number of the write request and the continuous data block being maintained in the first disk space are not Continuous. Therefore, the result of calculating the value of the current last serial number of the first disk space minus the value of the current starting sequence number (step 3〇8) is compared with the value of the current maximum number of the first disk space. The large value is assigned to the current maximum number of the first disk space (step 310), thereby updating the current maximum number of consecutive data blocks stored in the current maximum number of the first disk space. The data block number of the write request is then assigned to the current start sequence number and the current last sequence number of the first disk space (step 312) to open another continuous data block area in the first disk space. When the data block number of the intrusion request is greater than the value of the starting sequence number of the first disk space and the value of the maximum number, it indicates that the data block number 12 200826069 of the write request is not located on the first disk. space. At this time, it is further determined whether the data block number of the write request is equal to the value of the current last serial number of the first disk space plus one (step 400), that is, determining whether the data of the write request & block number is currently being maintained. The continuous data blocks are continuous. When the data block number of the write request is equal to the value of the current last serial number of the first disk space plus one, it indicates that the data block number of the write request is continuous with the continuous data block being maintained in the first disk space. . However, the data block number of the write request is not located in the first disk space, that is, the data block of the write request is not subjected to the write synchronous copy operation, so the value of the current last sequence number of the first disk space is first increased by 1 ( Step 402), then performing a write synchronous copy operation on the data block corresponding to the value of the current last serial number of the first disk space (step 404), thereby expanding the size of the first disk space. § Write to the clear block of the material block 5, the tiger does not find the value of the current last serial number of the first disk space plus 1, indicating that the data block number of the write request is in compliance with the first disk space. The results of the negative material block are not connected to each other's performance and thus need to initiate a first disk space. The data structure of the second disk space is the same as that of the first disk space, and the number of data blocks at the time of initialization is the maximum number of consecutive data blocks of the first disk space. In the second disk space initialization process, the data block number value of the write request is first given to the start sequence number, the current start sequence number, and the current last sequence number of the second disk space (step 406). Then calculating the result of subtracting the value of the current starting sequence number of the first disk space from the value of the current starting sequence number (step 408), and assigning the result to the larger value of the current maximum number of the first disk space to The maximum number of second disk spaces (step 41〇). 13 200826069 Finally, starting from the data block corresponding to the value of the starting sequence number of the second disk space, the same number of data blocks as the maximum number of the first disk are written to the synchronous copy operation (step 412). ). It can be seen from the above description that when the data block number of the write request is not located in the first disk space 'but the value of the last serial number of the first disk space is increased by one, the size of the first disk space can be realized. auto-adjust. And the write-to-synchronous copy operation set of all the simple blocks of the first disk space and the second disk space can be completed, and the system can greatly improve the system performance. . Figure 5 is a block diagram of the state of the first disk space 500 at different times. After the initialization - the disk space 5 (8), the starting serial number and the current starting number of Xiaotian A are the same value, which is the amount of the first tributary block of the first disk space. The current maximum value is the starting value of 1, and the maximum value is also the starting value 1 ′, that is, the first disk space 500 contains only one data block. The first disk space 5 of J 1 includes a first continuous data block area 502. In this day, the value of the starting sequence number of the first disk space 5〇〇 does not change, and the current starting sequence value is the number of the first data block of the first continuous data block area 5〇2. The value of the last serial number is the last one of the first continuous data block area 5〇2=the billiard block, which is the number of the pivot block requested by the upper-time writer. The current maximum number is still the starting value of 1. The first disk space 500 of the day 2 includes two consecutive data block areas, a first connection, a Lingbei block area 5〇2, and a second continuous data block area 5〇4. The first disk 14 200826069 The value of the starting sequence number of the space 500 remains unchanged, which is the serial number of the first bedding block of the first disk space 5〇〇. The value of the current starting sequence number becomes the serial number of the first data block of the second continuous data block area 504, and the value of the last serial number before # becomes the last data block of the second continuous data block area 5Q4. The serial number, the current maximum number is the number of data blocks in the first-continuous data block area 5 () 2. Although the present invention has been disclosed above in the above preferred embodiments, it is not intended to limit the scope of the present invention to those skilled in the art. In the context of the scope and spirit of the invention, it is within the scope of the invention to modify the door trim. Please refer to the attached patent application for the scope of protection defined by the present invention. BRIEF DESCRIPTION OF THE DRAWINGS FIG. 1 is a block diagram of a composition of a volume group of a prior art; FIG. 2 is a flowchart of a snapshot processing of a request by a writer of the prior art; FIG. 3 and FIG. A flow chart of a method for automatically adjusting the size of a write synchronous copy disk space of a snapshot device; and a state block diagram of the state of the first disk space at different times. [Main component symbol description] ! 〇〇 volume group 120 physical volume 140 physical block 500 15 200826069 502 first continuous data block area 504 second continuous data block area step 200 receives a write request sent by the user step 202 The snapshot step 204 traverses the hash table in the memory step 206 to find whether the corresponding item is found. Step 208 performs a write synchronous copy operation. Step 210 continues to send the write request step 300 to initiate the first disk space of a snapshot device. The data space of the disc space is subjected to the write synchronous copy operation step 302. The data block number of the write request is greater than the value of the start sequence number of the first disk space plus the value of the maximum number. Step 304 writes the requested data block. Whether the serial number is equal to the value of the current last serial number of the first disk space plus 1 step 306 adds the value of the current last serial number of the first disk space! Step 308 calculates a result of subtracting the value of the current last sequence number of the first disk space from the value of the current start sequence number. Step 310 assigns the result to the first value of the value of the current maximum number of the first disk space to the first value. The current maximum number of disk space step 312 assigns the data block number of the write request to the current start sequence number of the first disk space and the current last sequence number. 16 200826069 Step 400 Write Request I Data Block Number is equal to the first The value of the current last serial number of the disk space is incremented by 1. Step 402 adds 1 to the current last serial number of the first disk space. Step 4〇4 writes the data block corresponding to the current last serial value of the first disk space. The synchronous copy operation step 406 assigns the data block number of the write request to the start sequence number, the current start sequence number, and the current last sequence number of the second disk space. Step 408 calculates the current last sequence value of the first disk space. The result of subtracting the value of the current starting sequence number and the larger value of the value of the maximum number of # in the first disk space are assigned to the maximum number of the second disk space.
步驟412對第二礤碟空間之資料區塊進行寫入同步複製操 作 S 17Step 412: Write a synchronous copy operation to the data block of the second scratch space S 17