Maintaining block-level snapshots using free storage space
By intercepting the pruning command and storing snapshot data using storage space marked "free" in the file system, the problem of data snapshot occupies storage space and improves system performance and availability.
Patent Information
- Application Number
- CN202411436298.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2018-10-03
- Publication Date
- 2025-03-04
AI Technical Summary
When maintaining data snapshots, the existing technology can easily cause the available storage space to quickly fill up, resulting in reduced system performance and user dissatisfaction.
By intercepting the pruning command, determine and use the storage device part of the file system marked "free" to store snapshot data without taking up the storage space already used by the file system.
It realizes maintaining data snapshots without reducing the available storage space of the file system, improving the overall performance and availability of the system.
Smart Images

Figure CN119556852A_ABST
Abstract
Description
Description of the case This application is a divisional application of a patent application with application number 201880097153.9 (PCT / US2018 / 054234), which was submitted to the China Patent Office on March 3, 2021, with an international application date of October 3, 2018, and the invention name is "Maintaining block-level snapshots using free storage space". Background Art
[0001] Computing systems may maintain a history of data states (so-called "snapshots"), e.g., for subsequent restoration or retrieval of the data. Some systems maintain snapshots of the data on the same storage device where the original data is located. Other systems may maintain snapshots of the data on separate storage devices from where the original data is located, utilizing additional storage devices. Preserving snapshots in this manner, whether stored on the same or different storage devices from where the original data is located, may cause large amounts of available storage space to fill up quickly, resulting in reduced system performance and / or user frustration and dissatisfaction. Summary of the invention
[0002] In general, the technology of the present disclosure may enable a computing device to maintain a snapshot of data associated with a file system without sacrificing available storage space in an underlying storage device. The technology may enable a computing device to intercept a trim command to determine free space associated with a file system, and enable the computing device to maintain a record of file system transactions in a manner that can later reverse the file system transactions. For example, a computing device such as a mobile phone may include a storage device such as a solid-state drive (SSD), a heat-assisted magnetic recording (HAMR) device, a microwave-assisted magnetic recording (MAMR) device, or other suitable storage medium for storing data associated with a file system. In order to maintain the integrity of the file system or provide a history of file system data, the computing device maintains block-level snapshots of data associated with the file system over time. Rather than the example computing device using additional capacity of the storage device beyond the capacity already assigned to the file system to save the snapshot, the example computing device maintains the snapshot in a so-called "free block". As used herein, the term "free block" means a block of storage space that has been indicated as unused by the file system (or other program or application) (e.g., by trimming, based on the internal structure of the file system), but can be used to store snapshot data for the purpose of maintaining the snapshot and unknown to the file system. Even if the free blocks can be used to store snapshot data to the file system, the free blocks appear as "unused" and do not have any valid data. As a result, for only the user of the file system, any free blocks can appear as available storage of the computing device.
[0003] For example, if the file system subsequently attempts to read or write a free block, i.e., a block that the file system previously pruned under the control of the file system, the computing device can automatically rearrange the snapshot by moving the snapshot to a different free block. If the block device, including the SSD, knows which blocks are not used by the overlying file system, the block device can better manage itself (e.g., wear leveling). Therefore, a trim command is developed to allow the file system to signal or otherwise indicate to the block device that a specific location (e.g., a sector or sector range) is not used. In this way, the example computing device can maintain snapshots of data associated with the file system without the file system managing the snapshots and using portions of the storage device that the file system has marked as available for storing data. By not requiring the file system to manage snapshots, and by using portions of the storage device that the file system has marked as “free”, the described technology can transparently enable snapshots, thereby improving system integrity and availability. In addition, because the snapshots are transparently managed to the user of the computing device, the user may not attempt to limit the amount of storage space set aside for snapshots, thereby allowing additional snapshots to be stored, which may increase the likelihood of a successful recovery operation using the stored snapshots.
[0004] In one example, a method is described that includes intercepting, by at least one processor, a write command output from a file system of a computing device, the write command specifying new data to be written to a specific group of blocks of a storage device of the computing device; determining, based on a record of free blocks of the storage device, that the specific group of blocks of the storage device includes one or more free blocks of the storage device that is currently storing snapshot data as old data; in response to determining that the specific group of blocks of the storage device includes one or more free blocks of the storage device that is currently storing snapshot data as old data, moving, by at least one processor, the old data to other free blocks of the storage device; and after moving the old data to the other free blocks, forwarding, by the at least one processor, the write command to the storage device to cause the storage device to write the new data to the specific group of blocks.
[0005] In another example, a computing device is described, which includes a storage device and at least one processor. The at least one processor is configured to: intercept a write command output from a file system of the computing device, the write command specifying new data to be written to a specific group of blocks of a storage device of the computing device; determine, based on a record of free blocks of the storage device, that the specific group of blocks of the storage device includes one or more free blocks of a storage device that is currently storing snapshot data as old data; in response to determining that the specific group of blocks of the storage device includes one or more free blocks of a storage device that is currently storing snapshot data as old data; and move the old data to other free blocks, forward the write command to the storage device so that the storage device writes the new data to the specific group of blocks.
[0006] In another example, a computer-readable storage medium having instructions is described that, when executed, cause at least one processor of a computing device to: intercept a write command output from a file system of the computing device, the write command specifying new data to be written to a specific group of blocks of a storage device of the computing device; determine, based on a record of free blocks of the storage device, that the specific group of blocks of the storage device includes one or more free blocks of the storage device that is currently storing snapshot data as old data; in response to determining that the specific group of blocks of the storage device includes one or more free blocks of the storage device that is currently storing snapshot data as old data, move the old data to other free blocks of the storage device; and after moving the old data to the other free blocks, forward the write command to the storage device so that the storage device writes the new data to the specific group of blocks.
[0007] In yet another example, a system is described that includes a device for intercepting a write command output from a file system of a computing device, the write command specifying new data to be written to a specific group of blocks of a storage device of the computing device; a device for determining, based on a record of free blocks of the storage device, that the specific group of blocks of the storage device includes one or more free blocks of the storage device that are currently storing snapshot data as old data; a device for moving the old data to other free blocks of the storage device in response to determining that the specific group of blocks of the storage device includes one or more free blocks of the storage device that are currently storing snapshot data as old data; and a device for forwarding the write command to the storage device to cause the storage device to write the new data to the specific group of blocks after moving the old data to the other free blocks.
[0008] The details of one or more examples are set forth in the accompanying drawings and the description below.Other features, objects, and advantages of the disclosure will be apparent from the description and drawings, and from the claims. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] Figure 1 is a conceptual diagram illustrating an example computing device configured to maintain a block-level snapshot of a file system at a location on a storage device that was used but no longer contains valid data in accordance with one or more aspects of the present invention.
[0010] Figure 2 is a block diagram illustrating an example computing device configured to maintain a block-level snapshot of a file system of the computing device at a location on a storage device that was used but no longer contains valid data, in accordance with one or more aspects of the present disclosure.
[0011] Figure 3is a flow diagram illustrating example operations of an example computing system configured to maintain a block-level snapshot of a file system at a location on a storage device that was used but no longer contains valid data in accordance with one or more aspects of the present disclosure. DETAILED DESCRIPTION
[0012] Figure 1 is a conceptual diagram illustrating an example computing device configured to maintain a block-level snapshot of a file system at a location on a storage device that was used but no longer contains valid data, in accordance with one or more aspects of the present disclosure. Figure 1 Computing device 110 represents any computing device that maintains data locally on computing device 110. Examples of computing device 110 include mobile phones, tablet computers, laptop computers, desktop computers, servers, mainframes, wearable devices (e.g., computer watches, hearable devices, etc.), home automation devices, auxiliary devices, gaming consoles and systems, media players, e-book readers, television platforms, automotive navigation or infotainment systems, or any other type of mobile, non-mobile, wearable, and non-wearable computing device that maintains a file system.
[0013] The computing device 110 includes a file system 120 and a snapshot module 122, which are operably coupled to the storage device 160 via communication channels 114A and 114B (collectively referred to as "communication channels 114"). The file system 120 and the snapshot module 122 can perform operations described using software, hardware, firmware, or a mixture of software, hardware, and firmware that resides in and / or executes at the computing device 110. The computing system 110 can execute the file system 120 and the snapshot module 122 through multiple processors or multiple devices. The computing system 110 can execute the file system 120 and the snapshot module 122 as a virtual machine executed on the underlying hardware. The file system 120 and the snapshot module 122 can be executed as a service or component of the operating system or computing platform of the computing device 110. The file system 120 and the snapshot module 122 can be executed as one or more executable programs on the application layer of the computing platform. Although shown as discrete elements different from the storage device 160, the file system 120 and the snapshot module 122 can be software stored at the storage device 160.
[0014] File system 120 maintains information (e.g., data) on behalf of an operating system executing at computing device 110. File system 120 organizes and maintains information at storage device 160. File system 120 may issue read commands, write commands, and other types of commands to storage device 160. For example, file system 120 may send a read or write command over communication channel 114 that causes storage device 160 to write or read data. In some examples, file system 120 is YAFFS, JFFS, JFFS2, UBIFS, LogFS, F2FS, ext2, ext3, ext4, HFS, HFS+, FAT32, NTFS, APFS, UFS, or other types of file systems that have been designed to work with flash storage devices.
[0015] Storage device 160 represents any type of storage device configured to maintain data associated with file system 120 as one or more blocks, and enables a file system such as file system 120 to signal or otherwise indicate when a block that previously contained valid data is no longer in use, for example, via a trim command. Although primarily described as an SSD, in some examples, storage device 160 may include other types of computer-readable storage media. Examples of storage device 160 include SSDs or other types of storage devices that rely on flash memory, electrically programmable memory (EPROM), or electrically erasable programmable (EEPROM) memory. Other examples of storage device 160 include HAMR devices, MAMR devices. Storage device 160 can be configured to store a larger amount of information than volatile memory. Storage device 160 can be further configured to store information for a long time as a non-volatile storage space and retain the information after a power on / off cycle.
[0016] Storage device 160 stores information and provides access to that information during operation of computing device 110. Information stored on storage device 160 may be divided into data blocks. Each data block may be divided into a plurality of pages.
[0017] To delete data from a block, some SSDs may need to delete the entire block and then refill the block with any pages that are not deleted. In other words, the SSD may temporarily relocate any pages that are retained and not deleted from the target block to a temporary buffer. Then, after erasing the target data block including the page to be deleted, the SSD may refill the target block with the data retained in the temporary buffer. This way of managing data blocks and pages is inefficient and may therefore degrade performance.
[0018] To improve performance and extend useful life, other SSDs such as storage device 160 are configured to perform trimming. The trim command enables file system 120 to indicate to storage device 160 which data blocks are no longer needed. Also known as the "TRIM" command when implemented in accordance with the AT Attachment (ATA) packet interface and the "UNMAP" command in the Small Computer System Interface (SCSI), trimming enables the SSD to more efficiently handle garbage collection that would otherwise slow down future write operations to unused blocks. Rather than temporarily relocating pages to a temporary buffer, the SSD may simply mark a block as no longer having any valid data and during subsequent writes to the block, the SSD will write the new data to the block without saving any old data that remains on the block.
[0019] The snapshot module 122 utilizes the pruning functionality of the file system 120 and the storage device 160 to maintain snapshots of data associated with the file system 120. For example, if the file system 120 has to roll back to the state that the data was in before a change, the snapshot module 122 identifies when the data has changed, records the state of the data before the change, and stores the recorded state. Unlike other snapshot systems that store snapshots with operational data, or other snapshot systems that maintain snapshots on storage devices different from the storage devices that store operational data, the snapshot module 122 saves data snapshots on the same storage medium that maintains operational data, and does so without requiring the file system 120 to use any additional data storage beyond the data storage already used by the file system 120. In other words, the snapshot module 122 implements a snapshot system that does not require any additional storage space for the file system 120. That is, the total storage space occupied by the file system 120 and the stored snapshots appear from the perspective that the file system 120 requires the same size data footprint that is already attributed to the file system 120.
[0020] The snapshot module 122 stores the snapshot in a space called a "free block" on the storage device 160. For example, the storage device 160 includes used blocks and unused blocks. Before writing any blocks in the direction of the file system 120, the storage device 160 can mark any unwritten blocks as "unused blocks". The storage device 160 can freely write any unused blocks according to the command from the file system 120. Once written, the storage device 160 marks the unused blocks as "used blocks", and these blocks remain marked as used blocks until the file system 120 (e.g., via pruning) otherwise indicates that the used blocks no longer contain valid data and are no longer used.
[0021] However, instead of letting the storage device 160 know that the used blocks are no longer used to store valid data, the snapshot module 122 intercepts a signal (e.g., a trim command) from the file system 120 to make the storage device 160 have a "free block" for storing the snapshot. As used herein, the term "free block" means a block of storage space that the file system (or other program or application) has indicated (e.g., via trimming based on the internal structure of the file system) no longer contains valid data, but can be used to store snapshot data for the purpose of maintaining the snapshot and being unknown to the file system. Even though the free block can be used to store snapshot data to the file system, the free block appears to be "unused" and does not have any valid data.
[0022] Snapshot module 122 may store snapshots of data associated with file system 120 in these so-called "free blocks" so that the snapshots do not cause file system 120 to occupy any more storage space on storage device 160 than it is already using. If, for example, file system 120 subsequently attempts to write to any free blocks containing snapshots, snapshot module 122 may automatically move the snapshots to different free blocks. In this way, the example computing device may maintain snapshots of data associated with the file system without reducing the amount of storage that the file system is configured to use for storing additional data. For example, if Figure 1 As shown in , storage device 160 includes used blocks and unused blocks that have been configured as free blocks for storing snapshots 116A ("SNAP 116A") through 116N ("SNAP 116N") (collectively, "snapshots 116").
[0023] In operation, each block of the storage device 160 can be classified into one of four states: used, free, backup, and changed. Each block of the storage device 160 starts with a "used state", which indicates that the file system 120 maintains valid data in the block. When the file system 120 attempts to indicate to the storage device 160 (for example, by issuing a trim command) that the block is no longer used by the file system 120 to store valid data, the block moves to a "free state". After the block is considered a free block, the block is in a "backup state" and the block stores snapshot data. When the block is in a "changed state" after having previously been marked as being in a "free state" or a "backup state", the file system 120 begins to use the block again to store valid data.
[0024] Snapshot module 122 may intercept a trim command output from file system 120. The trim command may specify one or more blocks of storage device 160 that are no longer used by file system 120. Thus, snapshot module 122 may classify each of the one or more blocks as a “free block” to indicate that the blocks are no longer used to store any valid data. Figure 1As shown in , the snapshot module 122 can disable the communication channel 114B between the storage device 160 and the file system 120, so that all write-related commands (including trim commands) output by the file system 120 are first routed through the snapshot module 122 without reaching the storage device 160. In some examples, disabling the communication channel 114B can simply prevent the file system 120 from issuing write commands that can directly reach the storage device 160, without necessarily preventing the storage device 160 from receiving the write command (e.g., from the snapshot module 122). In other words, according to the described technology, disabling the communication channel 114B means preventing the file system 120 from directly communicating write commands and trim commands to the storage device 160, but requiring the snapshot module 122 to forward these commands after verifying their feasibility. In this way, the snapshot module 122 prevents the file system 120 from sending trim commands or other write commands directly to the storage device 160. By intercepting the trim command, the snapshot module 122 prevents the storage device 160 from disassociating one or more blocks specified by the trim command from the file system 120. That is, according to storage device 160, file system 120 is using the block specified by the intercepted trim command even though file system 120 no longer recognizes the block as having any usable or valid data.
[0025] After intercepting the trim command, snapshot module 122 takes steps to save the information contained in the trim command, for example, for processing subsequent write commands. That is, snapshot module 122 can generate a record of free blocks of storage device 160, which includes an indication of one or more blocks of storage device 160 that are no longer used by file system 120. The record of free blocks indicates which blocks of storage device 160 can be used or are storing snapshots.
[0026] At a future time, snapshot module 122 may intercept a write command output from file system 120. The write command may specify new data to be written to a particular group of blocks of storage device 160. For example, file system 120 may output the write command via communication channel 114B.
[0027] However, before the write command can reach storage device 160, snapshot module 122 intercepts the write command for further processing. Snapshot module 122 may determine whether the block referenced by the write command is listed as a free block, used block, backup block, or changed block in the record of free blocks.
[0028] If the write command references a backup block (i.e., a free block used to store snapshot data), the snapshot module 122 may reclassify the backup block as a changed block for storing valid data on behalf of the file system 120. The snapshot module 122 may take steps to save the snapshot data (as discussed in more detail below) in a different free block, at which point the snapshot module 122 may mark the different free block as a backup block. The snapshot module 122 may forward the write command unchanged from how the snapshot module 122 receives the write command to the storage device 160, so that the storage device 160 can write the valid data to the changed block.
[0029] If the write command references a free block that is not a backup block, the snapshot module 122 may not take any action to save the data stored on the free block, but mark the free block as changed and forward the write command to the storage device 160 so that the block can store valid operation data as a changed block. However, if the write command does not reference any backup block or free block, but references a used block or a changed block, the snapshot module 122 may copy the old data stored at the block referenced by the write command to the existing free block listed in the record as a snapshot 116A. After copying the old data as snapshot data to the existing free block, the snapshot module 122 may forward the write command to the storage device 160 so that the storage device writes the new data to the block referenced by the write command.
[0030] In this way, snapshot module 122 saves the state of data associated with file system 120 within the free blocks, and therefore does not use any additional unused blocks beyond those blocks already used by file system 120 before pruning. If for some reason file system 120 needs to roll back to old data, snapshot module 122 can replace the new data with the old data saved by snapshot 116 A. At this time, snapshot module 122 can update the record of free blocks to indicate the removal of snapshot 116A.
[0031] In this manner, an example computing device can maintain a snapshot of data associated with a file system without occupying any more storage capacity than already used by the file system. By not requiring any additional unused blocks to maintain a snapshot of a file system than already relied upon to maintain the file system, the described techniques can enable more computing devices to implement snapshots, thereby improving system integrity and availability.
[0032] Figure 2 is a block diagram illustrating an example computing device configured to maintain a block-level snapshot of a file system of the computing device at a location on a storage device that was used but no longer contains valid data, in accordance with one or more aspects of the present disclosure. Figure 2 The computing device 210 includes Figure 1Computing device 210 is an example of computing device 110 and is described in the context of computing device 110. Computing device 210 may include some or all of the capabilities of computing device 110. Figure 2 Only one particular example of computing device 210 is illustrated, and many other examples of computing device 210 may be used in other instances and may include a subset of the components included in the example computing device 210, or may include Figure 2 Additional components not shown.
[0033] As in Figure 2 As shown in the example of , computing device 210 includes user interface component (UIC) 212, one or more processors 240, one or more input components 242, one or more communication units 244, one or more output components 246, one or more storage components 248, and one or more storage devices 260. UIC 212 includes display component 202 and presence sensing input component 204.
[0034] The storage component 248 of the computing device 210 also includes the file system 220, the file system controller 224, the trim recorder 226, and the snapshot module 222. In addition, the storage component 248 includes a trim record data store 262A, a free block record data store 262B, and a snapshot location data store 262C (each of which may exist separately or together as one or more data stores). The data stores 262A-262C may be collectively referred to as "data stores 262".
[0035] Communication channel 250 can interconnect each of components 202, 204, 212, 214, 220, 222, 224, 226, 248, 260, and 262 for inter-component communication (physically, communicatively, and / or operatively). In some examples, communication channel 250 can include a system bus, a network connection, an inter-process communication data structure, or any other method for conveying data.
[0036] One or more input components 242 of computing device 210 can receive input. Examples of input are sensor, tactile, audio, and video input. In one example, input components 242 of computing device 200 include a presence-sensitive display, a touch-sensitive screen, a sensor, a mouse, a keyboard, a voice response system, a camera, a microphone, or any other type of device for detecting input from a person or a machine. In some examples, input components 242 include one or more location sensors (GPS components, Wi-Fi components, cellular components), one or more temperature sensors, one or more motion sensors (e.g., accelerometers, gyroscopes), one or more pressure sensors (e.g., barometers), one or more ambient light sensors, and one or more other sensors (e.g., microphones, cameras, infrared proximity sensors, hygrometers, etc.).
[0037] One or more output components 246 of computing device 210 can generate output. Examples of output are tactile, audio, and video output. In one example, output components 246 of computing device 210 include a presence-sensitive display, a sound card, a video graphics adapter card, a speaker, a cathode ray tube (CRT) monitor, a liquid crystal display (LCD), or any other type of device for producing output to a person or machine.
[0038] The one or more communication units 244 of the computing device 210 can communicate with external devices via one or more wired and / or wireless networks by sending and / or receiving network signals on one or more networks. Examples of the communication unit 244 include a network interface card (e.g., such as an Ethernet card), an optical transceiver, a radio frequency transceiver, a GPS receiver, or any other type of device that can send and / or receive information. Other examples of the communication unit 244 may include a shortwave radio, a cellular data radio, a wireless network radio, and a universal serial bus (USB) controller.
[0039] The UIC 212 of the computing device 200 includes a display component 202 and a presence-sensitive input component 204. The display component 202 can be a screen on which the UIC 212 displays information, and the presence-sensitive input component 204 can detect objects at and / or near the display component 202. As an example range, the presence-sensitive input component 204 can detect objects, such as a finger or a stylus, within two inches or less of the display component 202. The presence-sensitive input component 204 can determine the location (e.g., (x, y) coordinates) of the display component 202 at which the object is detected. In another example range, the presence-sensitive input component 204 can detect objects six inches or less from the display component 202, and other ranges are also possible. The presence-sensitive input component 204 can use capacitive, inductive, and / or optical recognition technology to determine the location of the display component 202 selected by the user's finger. In some examples, the presence-sensitive input component 204 also uses the tactile, audio, or video stimulation described with respect to the display component 202 to provide output to the user.
[0040] Although illustrated as an internal component of the computing device 210, the UIC 212 may also represent an external component that shares a data path for transmitting and / or receiving input and output with the computing device 210. For example, in one example, the UIC 212 represents a built-in component of the computing device 210 that is located within and physically connected to the external packaging of the computing device 210 (e.g., a screen on a mobile phone). In another example, the UIC 212 represents an external component of the computing device 210 that is located externally and physically separated from the packaging of the computing device 210 (e.g., a monitor, projector, etc. that shares a wired and / or wireless data path with a tablet).
[0041] One or more processors 240 can implement functions and / or execute instructions within the computing device 212. For example, the processor 240 on the computing device 212 can receive and execute instructions stored by the storage component 248 to perform the functions of the modules 220, 222, 224, and 226. The instructions executed by the processor 240 can cause the computing device 210 to store information within the storage component 248 during program execution, for example, at any of the data stores 262. Examples of the processor 240 include an application processor, a display controller, a sensor hub, and any other hardware configured to act as a processing unit. The modules 220, 220, 222, 224, and 226 can be operated by the processor 240 to perform various actions or functions of the computing device 210.
[0042] One or more storage components 248 within computing device 210 may store information for processing during operation of computing device 210 (e.g., computing device 210 may store data accessed by modules 220, 222, 224, and 226 during execution at computing device 210). In some examples, storage component 248 is a temporary memory, while in other examples, storage component 248 is a computer-readable storage medium.
[0043] As a memory, the main purpose of the storage component 248 may not be configured for long-term storage, but may be configured as a volatile memory for short-term storage of information, and therefore if the computing device 210 is powered off, the stored content is not retained. Examples of volatile memory include random access memory (RAM), dynamic random access memory (DRAM), static random access memory (SRAM), and other forms of volatile memory known in the art. In some examples, the storage component 248 also includes one or more computer-readable storage media. The storage component 248 can be configured to store a larger amount of information than volatile memory. The storage component 248 can be further configured as a non-volatile storage space for long-term storage of information and retain information after power on / off cycles. Examples of non-volatile memory include a magnetic hard disk, an optical disk, a floppy disk, a flash memory, or an electrically programmable memory (EPROM) or an electrically erasable programmable memory (EEPROM). The storage component 248 can store program instructions and / or information (e.g., data) associated with the modules 220, 222, 224, and 226, as well as data storage 262.
[0044] Computing device 210 includes one or more storage devices 260, which represent examples of storage devices 260. That is, unlike storage devices 248, which may be configured for long-term or short-term memory, storage devices 260 are primarily configured for long-term storage; thus, storage devices 260 retain data even after computing device 210 is powered off. Storage devices 260 represent any type of storage device configured to maintain data associated with file system 220 as one or more blocks, and enable file system 220 to relinquish control of any blocks that file system 220 had previously used, such as via a trim command.
[0045] The file system 220 may provide Figure 1 That is, file system 220 may maintain information (eg, data) on behalf of an operating system executing at computing device 210 .
[0046] File system controller 224 performs typical file system operations on behalf of file system 220. For example, file system controller 224 may perform all operations associated with maintaining, organizing, and updating data associated with file system 220 maintained at storage device 260. File system 224 may issue read commands, write commands, trim commands, and other commands to storage device 260.
[0047] The trim recorder 226 of the file system 220 intercepts the trim commands and write commands output by the system controller 224 to the storage device 260. The trim recorder prevents the trim commands and write commands from reaching the storage device 260 directly. Instead, the trim recorder 226 determines whether the outbound command is a trim command or a write command. The trim recorder 226 maintains the trim record data store 262A as a list of all trim and write commands originating from the file system controller 224. If it is not a trim command or a write command, the trim recorder 226 may forward the command to the storage device 260. In response to determining that the command is a trim command or a write command, the trim recorder 226 may add information about the command to the trim record data store 262A.
[0048] The snapshot module 222 of the file system 220 may provide Figure 1 10. However, unlike the example in which the snapshot module 122 is shown as a separate component of the file system 120, the snapshot module 122 of the computing device 110 shown in FIG. Figure 1 Unlike the example of , the snapshot module 222 is shown as being partially or completely integrated with the file system 220. The snapshot module 222 maintains snapshots of data associated with the file system 220 on the storage device 260. The snapshot module 222 maintains a record of the location where the snapshot is stored as a snapshot location data store 262C. The snapshot location data store 262C can store the location of the storage device 260 together with the corresponding block identifier. The snapshot module 222 can query the snapshot location data store 262C for a particular block identifier and, in response to the query, obtain the location of the storage device 260 that stores the corresponding snapshot of the particular block.
[0049] The snapshot module 222 may maintain the free block record data store 262B using the information contained in the trim record 262A and the snapshot location data store 262C. That is, the snapshot module 222 may include in the free block record data store 262B any blocks that have been previously referenced in a trim command and for which a snapshot may or may not currently be stored. The free block record data store 262B indicates whether each free block in the free block record is available for future snapshots or backups, and may further indicate whether each free block is currently associated with an existing snapshot or backup. When a trim or write command is added to the trim record data store 262A, the snapshot module 222 may determine whether the command references a block marked as a "free block" at the free block record data store 262B, and if so, whether the block corresponds to the location of an existing snapshot stored in one of the snapshot location data stores 262C.
[0050] For example, if the snapshot module 222 receives a trim command that does not reference any existing “free blocks” at the free block record data store 262B, the snapshot module 222 may add the blocks specified by the trim command as new blocks and refrain from forwarding the trim command to the storage device 260. If the snapshot module 222 receives a write command that does not reference any existing “free blocks” at the free block record data store 262B, the snapshot module 222 may simply forward the write command to the storage device 260 for execution. However, if the snapshot module 222 receives a write command at the free block record data store 262B that does reference an existing “free block”, or if the snapshot module 222 receives a write command that overwrites data associated with a block referenced in the snapshot location data store 262C, the snapshot module 222 may move or update one or more snapshots.
[0051] For example, in response to a write command referencing an existing "free block" at the free block record data store 262B, or in response to a write that overwrites data associated with a block referenced in the snapshot location data store 262C, the snapshot module 222 may move any snapshot stored at the existing free block to one or more other free blocks indicated in the free block record data store 262B. The snapshot module 222 may remove the block from the free block record data store 262B and forward the write command to the storage device 260 for the storage device 260 to execute the write command.
[0052] Figure 3 is a flow diagram illustrating example operations of an example computing system configured to maintain a block-level snapshot of a file system at a location on a storage device that was used but no longer contains valid data in accordance with one or more aspects of the present disclosure. Figure 3The process may be performed by one or more processors of a computing device, such as computing devices 110 and 210. In some examples, Figure 3 The steps of the process may be repeated, omitted and / or performed in any order. For illustrative purposes, the following Figure 2 The computing device 210 is depicted in the context of Figure 3 .
[0053] Consider an example where computing device 210 is undergoing an update to an operating system including file system 220. When upgrading the operating system, computing device 210 may take precautions to save old data (e.g., user data associated with a previous version of file system 220), for example, in the event that the upgrade is abnormal. Computing device 210 may create snapshot data of the operating system, user data, or any other old data that may be modified or overwritten during the upgrade, so that any old data that is modified or overwritten can be subsequently restored even if overwritten by new data (e.g., updated operating system data, new user data, etc.). Computing device 210 may automatically snapshot data during an upgrade of file system 220 or related features of computing device 210. Computing device 210 may take snapshots of data during the upgrade so that the data can be restored if the upgrade is reversed. Computing device 210 may perform snapshots without reducing the amount of storage space indicated as available to file system 220 for storing other data.
[0054] In operation, the computing device 210 may operate in a first state to intercept a trim command to build a record of free blocks. That is, the computing device 210 may intercept a trim command (300) to the storage device, and build a record of free blocks of the storage device based on the intercepted trim command. For example, when the trim command is output from the file system controller 224, the trim recorder 226 may intercept the trim command to prevent the trim command from reaching the storage device 260. The trim command may specify one or more "used blocks" of the storage device 260 that are no longer used by the file system 220.
[0055] Based on the intercepted trim command, computing device 210 may generate a record of free blocks of the storage device indicating one or more blocks of the storage device that are no longer used by the file system (302). For example, trim recorder 226 may create an entry in trim record data storage 262A to remember that file system controller 224 commanded the trim while preventing the actual trim command from being passed to storage device 260. Trim recorder 226 may store a block identifier associated with the trim command and add the block identifier to free block record 262B for subsequent use as a backup block for storing snapshot data.
[0056] After constructing the record of free blocks, the computing device 210 may operate in a second state to maintain a data snapshot at the storage device 260. For example, using the free block record 262B as a map of available space of the storage device 260 that can be used to store snapshots, the computing device 210 may identify used blocks and changed blocks of the storage device 260 that store valid data (e.g., user data or other types of data that are worth saving before updating). When the snapshot module 222 intercepts write commands issued by the file system 220, especially those commands that reference used blocks or changed blocks, the snapshot module 222 may save the valid data of the used blocks and changed blocks from the storage device 260 as snapshot data stored at the free blocks of the storage device 260 that is not currently maintaining a backup. The snapshot module 222 may cause the storage device 260 to write the snapshot data to the identified free block location while updating the snapshot data location data storage 262C. The snapshot module 222 may mark those free blocks that now store the snapshot data as backup blocks.
[0057] Once the snapshot has been created and stored at the backup block, computing device 210 may intercept a write command output from the file system (304). The write command may specify new data to be written to a particular group of blocks of the storage device.
[0058] The computing device 210 may determine whether any block from the particular group of blocks is in a record of free blocks (306), is a backup block, is a used block, or is a changed block. For example, the file system controller 224 may output a write command to cause data to be written to a particular block of the storage device 260. The snapshot module 222 may intercept the command and compare the block identifier of the particular block with the free block record 262B according to the command.
[0059] In response to identifying a particular block within the free block record data storage 262B (306, yes branch), the snapshot module 222 can perform operations to ensure that any snapshots saved in the particular block are not lost when the storage device 260 executes the write command. That is, the snapshot module 222 can determine whether there is any snapshot data stored at the particular block based on the search of the block within the snapshot location 262C. If the particular block does store snapshot data and is therefore a backup block, the snapshot module 222 can move any snapshot data stored at the particular backup block of the storage device 260 to a different free block (310) of the storage device 260 and update the snapshot location 262C with the new location of the data stored in the block of the particular group. The snapshot module 222 can then reclassify the backup block as a changed block, which now stores valid data after being previously free. If the particular block does not store snapshot data or is not free, the snapshot module 222 can pass the write command to the storage device 260 without moving any data.
[0060] Computing device 210 may remove the specific block from free block record data storage 262B (312). For example, because the specific block will be used by file system 220 and will no longer be a free block, snapshot module 222 may remove the entry in free block data storage 262B to omit the specific block; therefore, the specific block is not used to store snapshot data, but can once again store other data associated with file system 220.
[0061] In response to not identifying a particular block within free block record 262B (306, no branch), snapshot module 222 may determine whether the particular block previously contained valid data (308). If the particular block previously contained valid data (308, yes branch), snapshot module 222 may treat the block as a used block or a changed block and simply forward the write command received from file system controller 224 to storage device 260 for execution without having to move snapshot data or update snapshot location 262C. That is, when data is written to a used block or a changed block that has been marked as storing valid data, snapshot module 222 passes the write command to storage device 260 without modifying or taking other steps to save the data stored in the block. Alternatively, if the particular block did not previously contain valid data (308, no branch), snapshot module 222 may back up any potential snapshot data stored at the particular block by performing operations 310 and 312 as described above.
[0062] The storage device 260 may write the new data to one or more blocks of the storage device (314). In other words, after moving the snapshot data to corresponding free blocks or verifying that the write will not affect the free blocks storing the snapshot data, the snapshot module 222 may forward the write command received from the file system controller 224 to the storage device 260 to cause the storage device 260 to write the new data to the specific group of blocks.
[0063] The computing device 210 may operate in a third state in which the computing device 210 operates without executing a snapshot. The snapshot module 222 may receive an instruction from the file system 220 to stop saving a snapshot of data stored at the storage device 260. For example, in response to detecting an abnormality of the current version of the operating system currently executed at the computing device 210, the file system 220 may send a command for restoring previous data to the snapshot module 222. In response to the command, and when the computing device 210 rolls back to the previous version of the operating system, the snapshot module 222 may restore the data of the snapshot. Specifically, the snapshot module 222 may read the snapshot saved in the free block of the storage device 260 from the storage device 260. The snapshot module 222 may write data to the storage device 260 to restore the previous version by refilling the storage device 260 with the data of the old snapshot. The snapshot module 222 may cause the storage device 260 to replace the user data associated with the current version of the operating system with the user data associated with the previous version of the operating system stored as a snapshot.
[0064] Computing device 210 may disable recovery of storage device 260 (316) and discard the record of free blocks (318).Snapshot module 222 may stop maintaining free block record data store 262B or snapshot position data store 262C.
[0065] In some cases, computing device 210 may rely on snapshots to recover or restore old data. Computing device 210 may recover old data by at least obtaining the old data from corresponding free blocks and outputting a write command to the storage device in response to obtaining the old data from the corresponding free blocks so that the storage device writes the old data to the specific group of blocks from which the old data originated. For example, snapshot module 222 may send a read command to storage device 260 for reading snapshot data stored in free blocks. Snapshot module 222 may issue a subsequent write command so that storage device 260 then writes the old data stored as a snapshot back to the location where the original data was originally snapshotted.
[0066] Because computing device 210 utilizes free blocks to store snapshots, as opposed to utilizing additional storage space of storage device 260 or other storage devices (e.g., remote storage devices in the cloud), computing device 210 can perform operations to ensure that the snapshot is not overwritten if, for example, computing device 210 attempts to write new data to the free blocks.
[0067] For example, after having intercepted and forwarded the first write command to the storage device 260, the snapshot module 222 may intercept a second subsequent write command output from the file system controller 224 of the file system 220. The second write command may specify data to be written to a particular group of blocks of the storage device 260. Before forwarding the second write command to the particular group of blocks of the storage device 260, the snapshot module 222 may determine whether the second write command identifies any free blocks from the free block record data store 262B.
[0068] In response to determining, based on the free block record data store 262B, that the second write command identifies at least one free block specified in the free block record data store 262B, the snapshot module 222 may move any old data stored at the at least one free block to a different free block of the storage device 260. After moving the old data to the different free blocks (and after removing at least one free block from the free block record data store 262B), the snapshot module 222 may forward the second write command to the storage device 260 to cause the storage device 260 to write the new data originally specified in the second write command.
[0069] In addition to the above description, the user can be provided with a control that allows the user to select whether and when the system, program or feature described herein can enable the collection of user information (e.g., information about the user's social network, social behavior or activity, occupation, user's preference, or user's current location) and whether the user is sent content or communication from the server. In addition, some data can be processed in one or more ways before it is stored or used so that personally identifiable information is removed. For example, the user's identity can be processed so that personally identifiable information cannot be determined for the user. For example, the user's geographic location can be generalized (such as to the city, zip code, or state level) when obtaining location information so that the user's specific location cannot be determined. Therefore, the user can have control over what information is collected about the user, how to use the information, and what information is provided to the user.
[0070] Clause 1. A method, comprising: intercepting, by at least one processor, a write command output from a file system of a computing device, the write command specifying new data to be written to a specific group of blocks of a storage device of the computing device; determining, based on a record of free blocks of the storage device, that the specific group of blocks of the storage device includes one or more free blocks of the storage device that is currently storing snapshot data as old data; in response to determining that the specific group of blocks of the storage device includes one or more free blocks of the storage device that is currently storing snapshot data as old data, moving, by the at least one processor, the old data to other free blocks of the storage device; and after moving the old data to the other free blocks, forwarding, by the at least one processor, the write command to the storage device so that the storage device writes the new data to the specific group of blocks.
[0071] Clause 2. A method according to clause 1, wherein the write command is a first write command, and the method further comprises: restoring the old data to the blocks of the specific group by the at least one processor through at least the following operations: obtaining the old data from the other free blocks by the at least one processor; and in response to obtaining the old data from the other free blocks, outputting a second write command to the storage device so that the storage device writes the old data to the blocks of the specific group.
[0072] Clause 3. A method according to any one of Clauses 1-2, wherein the write command is a first write command, and the method further comprises: after forwarding the first write command to the storage device, intercepting, by the at least one processor, a second write command output from the file system, the second write command specifying different new data to be written to different groups of blocks of the storage device; in response to determining, at least in part based on the record of the free blocks, that the different groups of blocks of the storage device do not include any free blocks of the storage device that is currently storing snapshot data as old data, forwarding, by the at least one processor, the second write command to the storage device so that the storage device writes the different new data to the different groups of blocks.
[0073] Clause 4. The method according to Clause 3 further includes: in response to determining based on the record of the free blocks that the blocks of the different groups of the storage device do not include any free blocks of the storage device, the at least one processor forwards the second write command to the storage device so that the storage device writes the different new data to the blocks of the different groups.
[0074] Clause 5. The method according to any one of clauses 1-4 further includes: intercepting one or more trim commands output from the file system by the at least one processor; and updating the record of the free blocks by the at least one processor based on the one or more trim commands to include any blocks identified in the trim commands.
[0075] Clause 6. The method according to any one of clauses 1-5, wherein moving old data comprises: reading the old data from the storage device by the at least one processor; and writing the old data stored in the other free blocks to the storage device by the at least one processor.
[0076] Clause 7. The method of any of Clauses 1-6, wherein the record of free blocks further indicates whether each free block in the record of free blocks is available for storing a snapshot or is currently associated with an existing snapshot.
[0077] Clause 8. A method according to any one of Clauses 1-7, wherein: the old data is user data associated with a previous version of an operating system previously executed at the computing device, and the new data is user data associated with a current version of a current operating system currently executed at the computing device; and the method further comprises: in response to detecting an abnormality of the current version of the operating system currently executed at the computing device: rolling back to the previous version of the operating system by the at least one processor; and restoring the old data to the specific group of blocks by the at least one processor by causing the storage device to replace the user data associated with the current version of the operating system with the user data associated with the previous version of the operating system.
[0078] Clause 9. The method according to any one of Clauses 1-8 further includes: before intercepting the write command, the at least one processor copies the valid data stored in the used blocks of the storage device to one or more free blocks of the storage device as the snapshot data based on the record of the free blocks of the storage device.
[0079] Clause 10. A method, comprising: intercepting, by at least one processor of a computing device, one or more trim commands output from a file system of the computing device to a storage device of the computing device; generating, by the at least one processor, a record of free blocks of the storage device based on the one or more trim commands; and based on the record of free blocks of the storage device, copying, by the at least one processor, valid data stored at used blocks of the storage device as snapshot data to one or more free blocks of the storage device.
[0080] Clause 11. The method according to Clause 10 further includes: intercepting, by the at least one processor, a write command output from the file system, the write command specifying new data to be written to a specific group of blocks of the storage device; determining, based on the record of the free blocks, that the specific group of blocks of the storage device includes at least one of the one or more free blocks of the storage device that is currently storing the snapshot data as old data; in response to determining that the specific group of blocks of the storage device includes at least one of the one or more free blocks of the storage device that is currently storing the snapshot data as old data, moving, by the at least one processor, the old data to other free blocks of the storage device; and after moving the old data to the other free blocks, forwarding, by the at least one processor, the write command to the storage device so that the storage device writes the new data to the specific group of blocks.
[0081] Clause 12. The method of any one of clauses 1-11, wherein the storage device is a solid-state storage device.
[0082] Clause 13. A computing device comprising means for performing the method of any of clauses 1-12.
[0083] Clause 14. A computing device comprising at least one processor configured to perform the method of any of clauses 1-12.
[0084] Clause 15. A computer-readable storage medium storing instructions which, when executed, cause at least one processor to perform the method of any one of clauses 1-12.
[0085] In one or more examples, the functions described may be implemented in hardware, software, firmware, or any combination thereof. If implemented in software, the functions may be stored on or transmitted over a computer-readable medium as one or more instructions or codes and may be executed by a hardware-based processing unit. Computer-readable media may include computer-readable storage media corresponding to tangible media such as data storage media, or communication media including, for example, any medium that facilitates the transfer of a computer program from one place to another according to a communication protocol. In this manner, computer-readable media may generally correspond to (1) a non-transitory tangible computer-readable storage medium, or (2) a communication medium such as a signal or carrier wave. Data storage media may be any available media that can be accessed by one or more computers or one or more processors to retrieve instructions, codes, and / or data structures to implement the techniques described in the present disclosure. A computer program product may include a computer-readable medium.
[0086] As an example and not limitation, such computer-readable storage media may include RAM, ROM, EEPROM, CD-ROM or other optical disk storage, disk storage or other magnetic storage devices, flash memory or any other medium that can be used to store the required program code in the form of instructions or data structures and can be accessed by the computer. Moreover, any connection is appropriately referred to as a computer-readable medium. For example, if instructions are sent from a website, server or other remote source using coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL) or wireless technologies such as infrared, radio and microwave, the definition of the medium includes coaxial cable, fiber optic cable, twisted pair, DSL or wireless technologies such as infrared, radio and microwave. However, it should be understood that computer-readable storage media and data storage media do not include connections, carriers, signals or other transient media, but are directed to non-transient tangible storage media. Disks and optical disks as used herein include compact discs (CDs), laser optical discs, optical optical discs, digital versatile discs (DVDs), floppy disks and Blu-ray discs, where disks usually copy data magnetically, while optical discs use lasers to copy data optically. The above combination should also be included in the scope of computer-readable media.
[0087] Instructions may be executed by one or more processors, such as one or more digital signal processors (DSPs), general-purpose microprocessors, application-specific integrated circuits (ASICs), field programmable logic arrays (FPGAs), or other equivalent integrated or discrete logic circuits. Therefore, as used herein, the term "processor" may refer to any of the foregoing structures or any other structure suitable for implementing the techniques described herein. In addition, in some aspects, the functionality described herein may be provided within dedicated hardware and / or software modules. Moreover, the techniques may be fully implemented in one or more circuits or logic elements.
[0088] The techniques of the present disclosure may be implemented in a variety of devices or apparatuses, including wireless handsets, integrated circuits (ICs), or a set of ICs (e.g., chipsets). Various components, modules, or units are described in this disclosure to emphasize functional aspects of devices configured to perform the disclosed techniques, but do not necessarily need to be implemented by different hardware units. Rather, as described above, the various units may be combined in a hardware unit or provided by a collection of interoperable hardware units, including one or more processors as described above in combination with appropriate software and / or firmware.
[0089] Various examples have been described. These and other examples are within the scope of the following claims.
Claims
1. A method comprising: maintaining, by a snapshot module of an operating system of a computing device, a record of free blocks of a storage device, wherein the record of free blocks indicates that one or more free blocks of the storage device are currently storing snapshot data, wherein the one or more free blocks storing the snapshot data are indicated as not being used for a file system of the computing device; as well as managing, by the snapshot module, a request from the file system of the computing device to write data to the one or more free blocks of the storage device currently storing snapshot data; as well as After detecting an abnormality of the current version of the operating system, the snapshot module provides data of the one or more free blocks from the storage device currently storing snapshot data to restore the previous version of the operating system.
2. The method of claim 1 , wherein managing a request from the file system of the computing device to write data to the one or more free blocks of the storage device currently storing snapshot data comprises moving the snapshot data to other free blocks of the storage device.
3. The method of claim 2, wherein the snapshot data is restored to the one or more free blocks before restoring the operating system.
4. The method according to claim 2, further comprising: Restoring the snapshot data to the one or more free blocks by at least: Obtain snapshot data from the other free blocks; as well as In response to obtaining the snapshot data from the other free blocks, a write command is output to the storage device to cause the storage device to write the snapshot data to the one or more free blocks.
5. The method according to claim 2, wherein moving the snapshot data comprises: Reading the snapshot data from the storage device; as well as The snapshot data stored in the other free blocks is written into the storage device.
6. The method according to claim 1, further comprising: intercepting one or more trim commands output from the file system; as well as The record of free blocks is updated based on the one or more trim commands to include any blocks identified in the one or more trim commands.
7. The method according to claim 1, wherein: The record of free blocks further indicates whether each free block in the record of free blocks is available for storing a snapshot or is currently associated with an existing snapshot.
8. A computing device comprising: operating system; as well as At least one processor configured to perform operations comprising: maintaining, by a snapshot module of the operating system, a record of free blocks of a storage device, wherein the record of free blocks indicates that one or more free blocks of the storage device are currently storing snapshot data, wherein the one or more free blocks storing the snapshot data are indicated as not being used for a file system of the computing device; as well as managing, by the snapshot module, a request from the file system of the computing device to write data to the one or more free blocks of the storage device currently storing snapshot data; as well as After detecting an abnormality of the current version of the operating system, the snapshot module provides data of the one or more free blocks from the storage device currently storing snapshot data to restore the previous version of the operating system.
9. A computing device according to claim 8, wherein managing requests from the file system of the computing device to write data to the one or more free blocks of the storage device currently storing snapshot data includes moving the snapshot data to other free blocks of the storage device.
10. The computing device of claim 9, wherein the snapshot data is restored to the one or more free blocks before restoring the operating system.
11. The computing device of claim 9, the operations further comprising: Restoring the snapshot data to the one or more free blocks by at least: Obtain snapshot data from the other free blocks; as well as In response to obtaining the snapshot data from the other free blocks, a write command is output to the storage device to cause the storage device to write the snapshot data to the one or more free blocks.
12. The computing device of claim 9, wherein moving the snapshot data comprises: Reading the snapshot data from the storage device; as well as The snapshot data stored in the other free blocks is written into the storage device.
13. The computing device of claim 8, the operations further comprising: intercepting one or more trim commands output from the file system; as well as The record of free blocks is updated based on the one or more trim commands to include any blocks identified in the one or more trim commands.
14. The computing device of claim 8, wherein: The record of free blocks further indicates whether each free block in the record of free blocks is available for storing a snapshot or is currently associated with an existing snapshot.
15. A computer-readable storage medium storing instructions that, when executed, cause at least one processor to perform operations comprising: maintaining, by a snapshot module of an operating system of a computing device, a record of free blocks of a storage device, wherein the record of free blocks indicates that one or more free blocks of the storage device are currently storing snapshot data, wherein the one or more free blocks storing the snapshot data are indicated as not being used for a file system of the computing device; as well as managing, by the snapshot module, a request from the file system of the computing device to write data to the one or more free blocks of the storage device currently storing snapshot data; as well as After detecting an abnormality of the current version of the operating system, the snapshot module provides data of the one or more free blocks from the storage device currently storing snapshot data to restore the previous version of the operating system.
16. The computer-readable storage medium of claim 15, wherein managing a request from the file system of the computing device to write data to the one or more free blocks of the storage device currently storing snapshot data comprises moving the snapshot data to other free blocks of the storage device.
17. The computer-readable storage medium of claim 16, wherein the snapshot data is restored to the one or more free blocks before restoring the operating system.
18. The computer-readable storage medium of claim 16, the operations further comprising: Restoring the snapshot data to the one or more free blocks by at least: Obtain snapshot data from the other free blocks; as well as In response to obtaining the snapshot data from the other free blocks, a write command is output to the storage device to cause the storage device to write the snapshot data to the one or more free blocks.
19. The computer-readable storage medium of claim 16, wherein moving the snapshot data comprises: Reading the snapshot data from the storage device; as well as The snapshot data stored in the other free blocks is written into the storage device.
20. The computer-readable storage medium of claim 15, the operations further comprising: intercepting one or more trim commands output from the file system; as well as The record of free blocks is updated based on the one or more trim commands to include any blocks identified in the one or more trim commands.