Method and storage controller for managing storage devices
Patent Information
- Application Number
- CN202210457591.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2022-03-30
- Filing Date
- 2022-04-27
- Publication Date
- 2026-11-03
- Estimated Expiration
- 2042-04-27
AI Technical Summary
In existing technologies, data in hidden storage is at risk of being tampered with or deleted by host applications and operating systems, and the host cannot easily access the data in hidden storage when needed.
By introducing normal mode and hidden mode into storage devices, and using mode switching commands or the Set Feature command of the NVMe protocol, the operating mode and storage capacity of the storage devices can be adjusted to hide or show part of the storage space to the host, ensuring data security and controllable access.
It provides full storage capacity in normal mode, hides part of the storage space in hidden mode, improves data security, and allows the host to access the hidden data when needed, meeting the needs of different use cases.
Smart Images

Figure CN116501239B_ABST
Abstract
Description
Technical Field
[0001] This application generally relates to the field of storage technology. More specifically, this application relates to methods for managing storage devices, storage controllers, and storage devices. Background Technology
[0002] Figure 1A A block diagram of a solid-state storage device (SSD) is shown. The SSD 102 is coupled to a host computer to provide storage capabilities. The host computer and the SSD 102 can be coupled in various ways, including but not limited to connections via SATA (Serial Advanced Technology Attachment), SCSI (Small Computer System Interface), SAS (Serial Attached SCSI), IDE (Integrated Drive Electronics), USB (Universal Serial Bus), PCIe (Peripheral Component Interconnect Express), NVMe (NVM Express), Ethernet, Fibre Channel, and wireless communication networks. The host computer can be an information processing device capable of communicating with the storage device via the above methods, such as a personal computer, tablet computer, server, laptop computer, network switch, router, cellular phone, or personal digital assistant. Storage device 102 (hereinafter referred to as storage device) includes interface 103, control unit 104, one or more NVM chips 105 and DRAM (Dynamic Random Access Memory) 110.
[0003] The aforementioned NVM chip 105 includes common storage media such as NAND flash memory, phase-change memory, FeRAM (Ferroelectric RAM), MRAM (Magnetic Random Access Memory), and RRAM (Resistive Random Access Memory).
[0004] The aforementioned interface 103 can be adapted to exchange data with the host via methods such as SATA, IDE, USB, PCIe, NVMe, SAS, Ethernet, and Fibre Channel.
[0005] The aforementioned control unit 104 is used to control data transmission between interface 103, NVM chip 105, and DRAM 110, and is also used for memory management, host logical address to flash physical address mapping, erase leveling, bad block management, etc. Control unit 104 can be implemented in various ways, including software, hardware, firmware, or combinations thereof. For example, control unit 104 can be in the form of an FPGA (Field-programmable gate array), ASIC (Application Specific Integrated Circuit), or a combination thereof. Control unit 104 may also include a processor or controller, in which software is executed to manipulate the hardware of control unit 104 to process I / O (Input / Output) commands. Control unit 104 can also be coupled to DRAM 110 and can access data in DRAM 110. FTL tables and / or cached I / O command data can be stored in DRAM.
[0006] The control unit 104 includes a flash interface controller (or media interface controller, flash channel controller), which is coupled to the NVM chip 105. The flash interface controller issues commands to the NVM chip 105 in accordance with the interface protocol of the NVM chip 105 to operate the NVM chip 105, and receives the command execution results output from the NVM chip 105. Known NVM chip interface protocols include "Toggle", "ONFI", etc.
[0007] In storage device 102, an FTL (Flash Translation Layer) is used to maintain the mapping information from logical addresses (LBAs) to physical addresses. Logical addresses constitute the storage address space of the solid-state storage device as perceived by upper-layer software such as the operating system. Physical addresses are the addresses used to access the physical storage units of the solid-state storage device. In related technologies, address mapping can also be implemented using intermediate address formats. For example, a logical address can be mapped to an intermediate address, and then the intermediate address can be further mapped to a physical address. The table structure that stores the mapping information from logical addresses to physical addresses is called the FTL table. The FTL table is important metadata in the storage device. The entries in the FTL table record the address mapping relationships in the storage device, in units of data pages.
[0008] For some storage devices, the File Transfer Table (FTL) is provided by the host coupled to the storage device. The host's memory stores the FTL table, and the host's CPU executes the FTL software. In other cases, a storage management unit positioned between the host and the storage device provides the FTL. In these situations, the read / write commands received by the storage device indicate the physical address.
[0009] Commands provided by the host to the storage device may access the logical addresses corresponding to one or more entries in the FTL table. The control unit may also modify the format of commands received from interface 103 (e.g., split commands according to the size of the logical address space corresponding to the FTL entry) and process the modified commands. For clarity, this document describes the example of a read / write command received by the storage device accessing a single FTL entry.
[0010] Figure 1B This diagram illustrates a logical address space in the prior art. In the prior art, the logical address space is the storage address space provided by the storage device, and the host can use elements (logical addresses) in the logical address space to access the storage device. Generally, the size of the logical address (LBA) space that the host can access is the same as the size of the LBA space provided by the storage device. For the logical address space, the storage device manages the mapping between logical addresses and physical addresses through an FTL table.
[0011] Figure 1C A diagram illustrating host access to storage devices is shown. Figure 1C In this process, the host sends an I / O command (read / write command) to the storage device. The I / O command indicates the logical address (LBA address) to be accessed. The storage device translates the LBA address into a physical block address (PBA) based on the FTL table managed in the control unit. Then, the control unit accesses the NVM chip based on the PBA address.
[0012] With the continuous improvement of data storage technology, all kinds of data are stored in storage devices, such as user data, operating system data, application data, or data required for restoring the host to factory settings. In order to improve data security, some data should not be seen by users (such as data required for restoring the host to factory settings). This data can be hidden in the storage device. Hidden storage of data means that users or applications on the host side cannot see or access this data. Summary of the Invention
[0013] The hidden storage data mentioned in existing technology typically refers to data hidden from host applications but visible to the host operating system. If the operating system is compromised or misused, the hidden storage data is at risk of being tampered with or deleted. To improve the security of hidden storage data, it is desirable for the data to be hidden from both host applications and the operating system. Under normal circumstances, the host should not be able to access or modify the hidden storage data through applications or the operating system. The host should only be able to access the hidden storage data when it is needed. For example, when the host needs to restore factory settings, it should be able to access the data hidden in the storage device required for the factory reset to perform the reset.
[0014] To achieve the functionality of hiding data in hidden storage from both host applications and the operating system, the logical address space provided by the storage device is typically partitioned. Data requiring hidden storage is stored in a hidden space. Under normal circumstances, the logical address space provided by the storage device is not available to the host, and neither the host's applications nor the operating system can access the data stored in the hidden space. However, in some situations, such as when restoring factory settings, the host needs to access the data stored in the hidden space. In this case, the hidden space needs to be accessible to the host; that is, it needs to be visible to the host. Therefore, determining whether to hide or show the hidden space based on actual needs becomes a crucial aspect of managing hidden storage data.
[0015] The solution provided in this application embodiment allows the storage device to respond to received commands to adjust its working mode to normal mode or hidden mode, and to set the storage capacity value in different working modes. By adjusting the working mode, the storage device can hide part of the space from the host or open the hidden space to the host, so that the storage device can meet the data hiding requirements.
[0016] Furthermore, the command to adjust the working mode in the solution provided in this application embodiment can be a custom mode switching command, or it can be the Set Feature command defined by the NVMe protocol. By using the characteristics of different commands, the working mode switching can be achieved, which can meet the user's needs to the greatest extent, while ensuring the interaction compatibility between the storage device and the host.
[0017] Furthermore, the solution provided in this application introduces two sets of concepts: the host-visible logical address space and the logical address space, as well as the host logical address space and the device logical address space (see below for a detailed explanation of the concepts). The storage capacity of the storage device under different requirements can be set by combining the host-visible logical address space and the logical address space, or the storage capacity of the storage device under different requirements can be set by combining the host logical address space and the device logical address space. This diversified approach ensures that the data hiding requirements are met while further improving the performance of the storage device.
[0018] According to a first aspect of this application, a first method for managing a storage device is provided, comprising, in response to receiving a command that triggers the storage device to adjust its operating mode, setting an operating mode of the storage device, wherein the operating mode includes a normal mode and a hidden mode; and, in response to setting the operating mode of the storage device, further setting a value for indicating the storage capacity of the storage device; wherein the value of the storage capacity indicated by the hidden mode is different from that of the normal mode.
[0019] According to the method for managing a storage device according to the first aspect of this application, a second method for managing a storage device according to the first aspect of this application is provided, wherein setting a value for indicating the storage capacity of the storage device includes: in response to setting the storage device to a normal mode, setting the storage capacity of the storage device in the normal mode to a first capacity value; or in response to setting the storage device to a hidden mode, setting the storage capacity of the storage device in the hidden mode to a second capacity value, wherein the first capacity value is different from the second capacity value.
[0020] According to the first or second method for managing a storage device according to the first aspect of this application, a third method for managing a storage device according to the first aspect of this application is provided, wherein the command for adjusting the working mode is a mode switching command or a Set Feature command defined by the NVMe protocol.
[0021] According to the third method for managing a storage device according to the first aspect of this application, a fourth method for managing a storage device according to the first aspect of this application is provided, wherein setting the storage device to a normal mode or a hidden mode includes: in response to the command being a mode switching command, if the current operating mode of the storage device is the normal mode, then switching the operating mode of the storage device from the normal mode to the hidden mode; if the current operating mode of the storage device is the hidden mode, then switching the operating mode of the storage device from the hidden mode to the normal mode.
[0022] According to the fourth method for managing a storage device according to the first aspect of this application, a fifth method for managing a storage device according to the first aspect of this application is provided, wherein the storage capacity of the storage device is set to the first capacity value or the second capacity value according to the value of the parameter of the mode switching command indicated by the mode switching command.
[0023] According to the third method for managing a storage device according to the first aspect of this application, a sixth method for managing a storage device according to the first aspect of this application is provided, in response to the command being a Set Feature command defined by the NVMe protocol, setting the operating mode of the storage device and indicating the storage capacity value of the storage device according to one or more logical address ranges indicated by the Set Feature command.
[0024] According to one of the second to sixth methods for managing a storage device according to the first aspect of this application, a seventh method for managing a storage device according to the first aspect of this application is provided, wherein the logical address space is a storage address space provided by the storage device, and the host accesses the storage device using logical addresses that are elements of the logical address space. The method is characterized in that setting a value for indicating the storage capacity of the storage device includes: in response to setting the operating mode of the storage device, setting either the first capacity value or the second capacity value according to a logical address space visible to the host, wherein the logical address space visible to the host is the storage address space reported by the storage device to the host and accessed by the host as a block device.
[0025] According to one of the second to sixth methods for managing storage devices based on the first aspect of this application, an eighth method for managing storage devices based on the first aspect of this application is provided, wherein the device logical address space is a storage address space provided by the storage device, the host accesses the storage device using elements of the host logical address space, and for processing I / O commands provided by the host, the storage device converts elements of the host logical address space in the I / O commands into elements of the device logical address space, characterized in that setting a value for indicating the storage capacity of the storage device further includes: in response to setting the operating mode of the storage device, setting a first capacity value or a second capacity value based on the host logical address space, wherein the host logical address space is the storage address space reported by the storage device to the host and accessed by the host as a block device.
[0026] According to one of the methods for managing a storage device according to the eighth aspect of the first aspect of this application, a method for managing a storage device according to the ninth aspect of the first aspect of this application is provided, which sets a first capacity value or a second capacity value based on a host logical address space, comprising: in response to setting the operating mode of the storage device to a hidden mode, setting the second capacity value based on a first host logical address space; or in response to setting the operating mode of the storage device to a normal mode, setting the first capacity value based on a second host logical address space, wherein the second host logical address space includes the first host logical address space and a newly added host logical address space, and in the hidden mode, the newly added host logical address space is not visible to the host.
[0027] According to one of the ninth methods for managing a storage device according to the first aspect of this application, a tenth method for managing a storage device according to the first aspect of this application is provided, wherein the newly added host logical address space in the second host logical address space is located after the first host logical address space.
[0028] According to the ninth or tenth method for managing a storage device according to the first aspect of this application, an eleventh method for managing a storage device according to the first aspect of this application is provided, wherein in the normal mode, the newly added host logical address space is mapped to any location in the portion of the device logical address space that is not visible to the host.
[0029] According to the seventh or eighth method for managing a storage device according to the first aspect of this application, a twelfth method for managing a storage device according to the first aspect of this application is provided, which, in response to one or more logical address ranges indicated by the SetFeature command, sets the storage capacity of the storage device to a first capacity value or a second capacity value according to the one or more logical address ranges.
[0030] According to the twelfth method for managing a storage device according to the first aspect of this application, a thirteenth method for managing a storage device according to the first aspect of this application is provided, wherein setting the storage capacity of the storage device to a first capacity value or a second capacity value according to the one or more logical address ranges includes: in response to the one or more logical address ranges indicated by the Set Feature command being described as a logical address space visible to the host, setting the operating mode of the storage device to a normal mode, and setting the storage capacity of the storage device to a first capacity value according to the one or more logical address ranges; or in response to the one or more logical address ranges indicated by the Set Feature command being described as a logical address space hidden from the host, setting the operating mode of the storage device to a hidden mode, and setting the storage capacity of the storage device to a second capacity value according to the one or more logical address ranges.
[0031] According to the twelfth method for managing a storage device according to the first aspect of this application, a fourteenth method for managing a storage device according to the first aspect of this application is provided, wherein setting a value for indicating the storage capacity of the storage device includes: in response to the Set Feature command indicating one or more logical address ranges being described as a host logical address space, setting the operating mode of the storage device to a normal mode, and setting the storage capacity of the storage device to a first capacity value according to the one or more logical address ranges; or in response to the Set Feature command indicating one or more logical address ranges being a portion of the device logical address space, and that portion of the device logical address space not having a corresponding host logical address space, setting a second capacity value according to the host logical address space.
[0032] According to one of the seventh methods for managing a storage device according to the first aspect of this application, a fifteenth method for managing a storage device according to the first aspect of this application is provided, wherein in response to the command being a mode switching command, the operating mode of the storage device is set to a hidden mode, and the second capacity value is set according to the logical address space visible to the host; or in response to the command being a mode switching command, the operating mode of the storage device is set to a normal mode, and the first capacity value is set according to the logical address space visible to the host.
[0033] According to the fifteenth method for managing a storage device according to the first aspect of this application, a sixteenth method for managing a storage device according to the first aspect of this application is provided, further comprising: setting a relationship between the host logical address space and the device logical address space, wherein the device logical address space refers to the logical address space managed by the storage medium management unit of the storage device.
[0034] According to the eighth method for managing a storage device according to the first aspect of this application, a seventeenth method for managing a storage device according to the first aspect of this application is provided, wherein in response to the command being a mode switching command, the operating mode of the storage device is set to a hidden mode, and the second capacity value is set according to the host logical address space; or in response to the command being a mode switching command, the operating mode of the storage device is set to a normal mode, and the first capacity value is set according to the host logical address space.
[0035] According to one of the fifteenth to seventeenth methods for managing a storage device according to the first aspect of this application, an eighteenth method for managing a storage device according to the first aspect of this application is provided, further comprising: in response to the command being a mode switching command and the working mode being set to a hidden mode, the size of the host logical address space being smaller than the size of the device logical address space; or in response to the command being a mode switching command and the working mode being set to a normal mode, the size of the host logical address space being equal to the size of the device logical address space.
[0036] According to one of the fifteenth to seventeenth methods for managing a storage device according to the first aspect of this application, a nineteenth method for managing a storage device according to the first aspect of this application is provided, further comprising: in response to the command being a Set Feature command and the operating mode being set to a hidden mode, the size of the host logical address space is equal to the size of the logical address space of the device logical address space excluding the segment or multiple logical address intervals indicated by the Set Feature command; in response to the command being a Set Feature command and the operating mode being set to a normal mode, the size of the host logical address space is equal to the size of the segment or multiple logical address intervals indicated by the Set Feature command.
[0037] According to one of the fifteenth to seventeenth methods for managing a storage device according to the first aspect of this application, a twentieth method for managing a storage device according to the first aspect of this application is provided, in response to the command being a Set Feature command and the operating mode being set to normal mode, wherein the size of one or more logical address ranges indicated by the Set Feature command is less than or equal to the device logical address space.
[0038] According to the twelfth or fourteenth method for managing a storage device according to the first aspect of this application, a twenty-first method for managing a storage device according to the first aspect of this application is provided, further comprising: in response to the command being a mode switching command and the working mode being set to a hidden mode, the size of the logical address space visible to the host is smaller than the size of the logical address space; or in response to the command being a mode switching command and the working mode being set to a normal mode, the size of the logical address space visible to the host is equal to the size of the logical address space.
[0039] According to the twelfth or fourteenth method for managing a storage device according to the first aspect of this application, a twenty-second method for managing a storage device according to the first aspect of this application is provided, further comprising: in response to the command being a Set Feature command and the operating mode being set to a hidden mode, the size of the logical address space visible to the host is equal to the size of the logical address space excluding the segment or multiple logical address ranges indicated by the Set Feature command; in response to the command being a Set Feature command and the operating mode being set to a normal mode, the size of the logical address space visible to the host is equal to the size of the segment or multiple logical address ranges indicated by the Set Feature command.
[0040] According to the twelfth or fourteenth method for managing a storage device according to the first aspect of this application, a twenty-third method for managing a storage device according to the first aspect of this application is provided, in response to the command being a Set Feature command and the operating mode being set to normal mode, wherein the size of one or more logical address ranges indicated by the Set Feature command is less than or equal to the logical address space.
[0041] According to one of the second to twenty-third methods for managing storage devices based on the first aspect of this application, a twenty-fourth method for managing storage devices based on the first aspect of this application is provided, the method further comprising: in response to receiving an ideationity command, if the current operating mode of the storage device is normal mode, feeding back the first capacity value to the host; if the current operating mode of the storage device is hidden mode, feeding back the second capacity value to the host.
[0042] According to the seventh method for managing a storage device or the eighth method for managing a storage device according to the first aspect of this application, a twenty-fifth method for managing a storage device according to the first aspect of this application is provided, the method further comprising: in response to receiving an IO command, obtaining the logical address accessed by the IO command; and in response to the logical address accessed by the IO command exceeding the logical address space visible to the host or the host logical address accessed by the IO command exceeding the host logical address space, returning an error message.
[0043] According to the seventh method for managing a storage device or the eighth method for managing a storage device according to the first aspect of this application, a twenty-sixth method for managing a storage device according to the first aspect of this application is provided, the method further comprising: in response to performing a garbage collection operation, performing a garbage collection operation on the logical address space corresponding to the storage device or the physical address space indicated by the device logical address space.
[0044] According to one of the first to twenty-sixth methods for managing a storage device according to the first aspect of this application, a twenty-seventh method for managing a storage device according to the first aspect of this application is provided, the method further comprising: setting the factory operating mode of the storage device to the hidden mode.
[0045] According to the twenty-seventh method for managing a storage device according to the first aspect of this application, a twenty-eighth method for managing a storage device according to the first aspect of this application is provided, wherein setting the factory operating mode of the storage device to the hidden mode includes: setting a logical address space visible to the host and a logical address space hidden by the host, wherein the logical address space hidden by the host is a storage address space that the storage device does not report to the host in the hidden mode and is invisible or inaccessible to the host.
[0046] According to the twenty-eighth method for managing a storage device according to the first aspect of this application, a twenty-ninth method for managing a storage device according to the first aspect of this application is provided, wherein the host-hidden logical address space is located after the host-visible logical address space.
[0047] According to one of the first to twenty-ninth methods for managing a storage device according to the first aspect of this application, a thirtieth method for managing a storage device according to the first aspect of this application is provided, the method further comprising: in response to the storage device being powered off and then powered on again, switching the operating mode of the storage device to a hidden mode or maintaining it in the operating mode before power-off.
[0048] According to the thirtieth method for managing a storage device according to the first aspect of this application, a thirty-first method for managing a storage device according to the first aspect of this application is provided, wherein switching the operating mode of the storage device to a hidden mode or maintaining it as the operating mode before power-down includes: setting the operating mode of the storage device to the operating mode after power-up indicated by the mode switching command; or setting the operating mode of the storage device to the operating mode after power-up recorded in the controller or non-volatile memory of the storage device; or setting the operating mode of the storage device to the operating mode obtained when the storage device is started; or, in response to the storage device being set to a hidden mode by a Set Feature command before power-down, setting the operating mode of the storage device to the hidden mode set before power-down.
[0049] According to a second aspect of this application, a storage controller is provided, the storage controller being configured to implement one of the first to thirty-first methods for managing storage devices according to the first aspect of this application.
[0050] According to a third aspect of this application, a storage device is provided, including a storage medium and a storage controller as described in the second aspect of this application. Attached Figure Description
[0051] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For those skilled in the art, other drawings can be obtained based on these drawings.
[0052] Figure 1A A block diagram of a solid-state storage device is shown.
[0053] Figure 1B A schematic diagram illustrating the mapping of logical address space in the prior art is shown;
[0054] Figure 1C This diagram illustrates a host accessing a storage device.
[0055] Figure 2A A flowchart illustrating a method for managing storage devices provided in an embodiment of this application is shown.
[0056] Figure 2B This application illustrates the storage capacity values set in different operating modes of the storage device provided in the embodiments of this application;
[0057] Figure 3AThis illustration shows a schematic diagram of the LBA space presented to the host by a hidden mode storage device according to an embodiment of this application;
[0058] Figure 3B This application provides a schematic diagram illustrating another hidden mode mapping between the host LBA space and the device LBA space.
[0059] Figure 3C This application provides a schematic diagram illustrating the mapping between a host LBA space and a device LBA space in a normal mode.
[0060] Figure 4A This application provides a schematic diagram illustrating the mapping between the host LBA space and the device LBA space in yet another hidden mode.
[0061] Figure 4B This application illustrates a schematic diagram of the mapping between the host LBA space and the device LBA space in another normal mode, provided by an embodiment of this application; and
[0062] Figure 4C This illustration shows a schematic diagram of the mapping between the host LBA space and the device LBA space in another normal mode provided by another embodiment of this application. Detailed Implementation
[0063] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0064] According to embodiments of this application, the storage device has multiple operating modes, including at least a hidden mode and a normal mode. In hidden mode, the storage device provides a portion, but not all, of its logical address space to the host, so that the host only knows a portion of the storage device's logical address space. Furthermore, if the host attempts to access a logical address space that exists in the storage device but is not provided to the host, the storage device will reject such access requests from the host and report an error.
[0065] Normal mode is a working mode that contrasts with the hidden mode described above. In normal mode, the hidden logical address space is visible to the host. Optionally, in normal mode, the logical address space provided by the storage device to the host is the same as or smaller than the logical address space maintained internally by the storage device. Understandably, in some implementations, the storage device also maintains other ranges of logical address space internally, which are not visible to the host in either normal mode or hidden mode.
[0066] The following examples briefly describe the working process of storage devices or hosts in hidden mode and normal mode scenarios.
[0067] Figure 2A A flowchart illustrating a method 200 for managing a storage device according to an embodiment of this application is shown. As shown in FIG2, in step S201, the operating mode of the storage device can be set in response to receiving a command that triggers the storage device to adjust its operating mode. In one implementation, the aforementioned command can be sent from the host to the storage device. Specifically, when a user discovers the need to use hidden data to perform certain specific tasks or operations (e.g., a user discovers malicious code (such as a virus) in the host's operating system), or when the use of hidden data is not required, a command can be sent from the host to the storage device. Upon receiving the command, the storage device can adjust its operating mode to either normal mode or hidden mode according to the command.
[0068] In step S202, in response to setting the operating mode of the storage device, a value indicating the storage capacity of the storage device can also be set. As one implementation, the storage capacity value of the storage device in hidden mode differs from its storage capacity value in normal mode. Generally, the storage capacity value in hidden mode is smaller than the storage capacity value in normal mode. Therefore, by setting the operating mode and storage capacity, the storage device makes the available storage capacity to the host different in different operating modes. Especially in hidden mode, the storage capacity value set by the storage device to be disclosed to the host is a portion of its storage capacity value, not the entire storage capacity value. This hides a portion of the storage address space of the storage device from the host, preventing the host from accessing or modifying the data in this hidden storage address space through its applications or operating system. The host can only access the hidden storage data when it is needed.
[0069] Figure 2B The storage capacity values set in different operating modes of the storage device provided in the embodiments of this application are shown.
[0070] For example, the actual total storage capacity of the storage device is 356GB, meaning the logical address space managed by the storage device through the FTL table is 356GB. Of this, in hidden mode, the storage address space that the storage device can hide from the host is 100GB. See also... Figure 2B If the storage device is set to normal mode, its storage capacity in normal mode can be set to capacity value A; if the storage device is set to hidden mode, its storage capacity in hidden mode can be set to capacity value B. Capacity value A is 356GB, and capacity value B is 256GB. This means that the storage capacity of the storage device in normal mode is usually greater than its storage capacity in hidden mode.
[0071] For simplicity and convenience, the storage capacity value set by the storage device in normal mode will be labeled as capacity value A, and the storage capacity value set by the storage device in hidden mode will be labeled as capacity value B.
[0072] According to the embodiments of this application, the command for adjusting the working mode received by the aforementioned storage device can be of various types. For example, the command for adjusting the working mode received by the storage device can be a custom mode switching command or a Set Feature command defined by the NVMe protocol.
[0073] In one implementation, if the aforementioned command to adjust the operating mode is a mode switching command, specifically, when the storage device receives the mode switching command, if the current operating mode is normal mode, the storage device switches its operating mode from normal mode to the hidden mode. If the current operating mode of the storage device is hidden mode, the storage device switches its operating mode from hidden mode to normal mode. Simultaneously, the storage capacity of the storage device can be set to capacity value A or capacity value B according to the value of the parameters indicated by the mode switching command.
[0074] The aforementioned mode switching command is a custom command, not a protocol-defined command; however, its format conforms to a protocol (such as the NVMe protocol). For example, a mode switching command includes a "command code" and optionally "command parameters." The command code has a specified value to indicate that the current command is a mode switching command. The host specifies the content of the mode switching command or the parameter values. For example, the mode switching command provided by the host to the storage device only includes the command code (without specifying command parameters). The storage device identifies the received command as a mode switching command based on the command code and changes its current mode accordingly. For example, if the storage device is currently in hidden mode, it changes to normal mode in response to receiving the mode switching command; and / or if the storage device is currently in normal mode, it changes to hidden mode in response to receiving the mode switching command. In another example, the mode switching command provided by the host to the storage device includes a command code and command parameters. The storage device identifies the received command as a mode switching command based on the command code and then determines the mode the storage device wants to enter based on the command parameters. When the command parameter is, for example, 0, it indicates switching from hidden mode to normal mode; when the command parameter is, for example, 1, it indicates switching from normal mode to hidden mode.
[0075] The host defines the content of the mode switching command to instruct the storage device to perform a working mode switching operation after receiving the mode switching command, or to configure the parameters of the mode switching command. For example, the host instructs the storage device to perform a working mode switching operation after receiving the mode switching command by setting the value of the command parameter in the mode switching command.
[0076] When the host defines the content of the mode switching command, the storage device switches its current operating mode according to the command. For example, in response to receiving the mode switching command in normal mode, the storage device switches from normal mode to hidden mode; or in response to receiving the mode switching command in hidden mode, the storage device switches from hidden mode to normal mode. When the host configures the command parameters of the mode switching command, the storage device switches its operating mode according to the value of the command parameters. For example, the host configures the command parameters of the mode switching command based on the current operating mode of the storage device. For instance, if the current operating mode of the storage device is hidden mode, and the command parameter is configured to 0 to control the storage device to switch to normal mode, the storage device switches to normal mode according to the command parameter value; if the current operating mode of the storage device is normal mode, and the command parameter is configured to 1 to control the storage device to switch to hidden mode, the storage device switches to hidden mode according to the command parameter value.
[0077] As an example, the specific format of the host-defined mode switching command can also include a command code and two or more command parameters to implement more functions.
[0078] In one implementation, a mode switching command, carrying different command parameters, instructs the storage device to: set to hidden mode, set to normal mode, and set the size of the hidden LBA space. The functions of setting to hidden mode and normal mode are suitable for use during storage device operation, while the function of setting the size of the hidden LBA space is suitable for use during storage device manufacturing to provide users with a storage device having a specified size of hidden space. When the mode switching command instructs the user to set the size of the hidden LBA space, further command parameters describe the value of the hidden LBA space size.
[0079] Furthermore, a command parameter of the mode switching command indicates the length of data to be transmitted in the current command, to meet the requirements of the host and storage device. The host and / or storage device determine whether the processing of the current command is complete by recognizing the length of data to be transmitted in the command parameter. Since the mode switching command does not require data transmission between the host and storage device, this command parameter is set to 0 in the mode switching command.
[0080] Similarly, another command parameter of the mode switching command is used to indicate the length of the metadata to be transmitted by the current command. In the embodiments according to this application, this command parameter is also set to 0 in the mode switching command.
[0081] When the mode switching command instructs the setting of the hidden LBA space size, it also indicates, for example, whether to initialize the hidden LBA space, whether the hidden LBA space needs to be aligned to 4KB, etc., through one or more command parameters.
[0082] As another implementation, the aforementioned command can be the Set Feature command defined by the NVMe protocol. The Set Feature command of the NVMe protocol can set various different "features" through command parameters. For a specific storage device, some "features" are not supported, so when it receives a Set Feature command for such a feature, it does not need to process it. Therefore, the Set Feature command indicating such a feature can be used as a mode switching command, thus eliminating the need to add a new command.
[0083] As an example, "LBA Range Type" is one of the features that the Set Feature command can indicate, but some current storage devices do not support this feature. Therefore, the Set Feature command with the "LBA Range Type" command parameter is used as the mode switching command according to embodiments of this application. For this purpose, in addition to carrying the "LBA Range Type" command parameter, the Set Feature command also carries one or more command parameters to instruct the storage device to: set to hidden mode, set to normal mode, and set the size of the hidden LBA space. Furthermore, when the mode switching command instructs the setting of the hidden LBA space size, one or more command parameters also indicate, for example, whether to initialize the hidden LBA space, whether the hidden LBA space needs 4KB alignment, etc. Specifically, the "Data Structure Entry" field of the Set Feature command with the "LBA Range Type" command parameter is used to describe one or more parameters used for the mode switching command.
[0084] In another example, the Set Feature command indicates two logical address ranges: LBA0~LAB100 and LBA200~LBA300. This application embodiment, based on the existing NVMe protocol's definition that the Set Feature command can indicate one or more logical address ranges, further sets the one or more logical address ranges indicated by the Set Feature command to be either host-accessible or host-inaccessible, thereby enabling the hiding or showing of a portion of the storage device's logical address space to the host. Furthermore, the operating mode of the storage device and the storage capacity can be set according to the one or more logical address ranges indicated by the Set Feature command. For example, these one or more logical address ranges can be set by the user using the Set Feature command. Understandably, in some implementations, the user can also directly set the Set Feature command defined by the NVMe protocol, so that the Set Feature command instructs the storage device to switch modes; that is, after receiving the Set Feature command, the storage device enters or exits hidden mode according to the switching mode indicated by the Set Feature command.
[0085] For ease of understanding, the solutions provided in this application introduce two sets of concepts: host-visible logical address space and logical address space, as well as host logical address space and device logical address space. The logical address space (LBA space) is the storage address space provided by the storage device, and the host uses logical addresses that are elements of this logical address space to access the storage device. Since the storage device can switch between normal mode and hidden mode, in hidden mode, the storage device hides part of its logical address space from the host. For ease of understanding and explanation, this application introduces the concepts of host-visible logical address space (host-visible LBA space) and hidden logical address space (hidden LBA space) based on the logical address space. The host-visible logical address space is the storage address space within the logical address space that the storage device reports to the host and is accessed by the host as a block device, while the hidden LBA space is the storage address space within the logical address space in hidden mode that the storage device does not report to the host and cannot be accessed by the host as a block device.
[0086] The device logical address space is the storage address space provided by the storage device. The host uses elements of the host logical address space to access the storage device. To process I / O commands provided by the host, the storage device translates elements of the host logical address space in the I / O command into elements of the device logical address space. The host logical address space is the storage address space reported by the storage device to the host and accessed by the host as a block device. Therefore, the hidden space mentioned earlier can be understood as the aforementioned hidden logical address space or a portion of the device logical address space that has no mapping relationship with the host logical address space.
[0087] The following combination Figures 3A-3C The process of setting the storage capacity of storage devices is further explained.
[0088] Figure 3A This illustration shows a schematic diagram of the LBA space presented to the host by the hidden mode storage device provided in an embodiment of this application. For example... Figure 3A As shown, in one implementation, the storage capacity of the storage device in hidden mode or normal mode can be set according to the logical address space visible to the host. For example, in... Figure 3A In this context, the LBA space includes the host-visible LBA space and the hidden LBA space, where the host-visible LBA space is part or all of the storage address space of the LBA space.
[0089] As an example, the host-visible logical address space provided in this application embodiment is a dynamically variable storage address space. When the storage device is in normal mode, the application and / or operating system on the host can see or access this hidden LBA space. At this time, the host-visible logical address space is the entire logical address space, and its size is the same as the logical address space. When the storage device is in hidden mode, the hidden LBA space is an "LBA space" that is not visible or accessible to the application and / or operating system on the host. At this time, the host-visible logical address space is a portion of the logical address space, and its size is smaller than the logical address space.
[0090] The storage device's operating mode can be switched based on a mode switching command or a Set Feature command. As one implementation, the command triggering the storage device to adjust its operating mode is a mode switching command. This command can set the storage device's operating mode to hidden mode and set a capacity value B based on the host-visible logical address space, or set the storage device's operating mode to normal mode and set a capacity value A based on the host-visible logical address space. In hidden mode, the size of the host-visible logical address space is smaller than the total logical address space. In normal mode, the size of the host-visible logical address space is equal to the total logical address space.
[0091] In another implementation, the command that triggers the storage device to adjust its operating mode is a Set Feature command. The Set Feature command can set the operating mode of the storage device and indicate the storage capacity value based on one or more logical address ranges. For example, the storage capacity of the storage device can be set to capacity value A or capacity B based on one or more logical address ranges described by the Set Feature command.
[0092] In one implementation, if the logical address range indicated by the Set Feature command is described as a logical address space visible to the host, then the operating mode of the storage device is set to normal mode, and the storage capacity of the storage device is set to capacity value A according to the aforementioned logical address range. If the logical address range indicated by the Set Feature command is described as a logical address space hidden from the host, the operating mode of the storage device can be set to hidden mode, and the storage capacity of the storage device can be set to capacity value B according to the aforementioned logical address range.
[0093] It is understandable that in some embodiments, when multiple logical address regions are described as logical address spaces hidden from the host, after the storage device switches to normal mode, all or part of the aforementioned multiple logical address regions can be redescribed as logical address spaces visible to the host. It should be noted that since the host obtains the storage device's capacity value in different operating modes, for example, if the host obtains a storage device capacity value of 100GB, then the host will consider that it can access 0-100GB of storage space. When the host writes data to the 0-100GB storage space, the host records the logical address of the data in the storage space in the file system. When the storage device switches from hidden mode to normal mode, the capacity value provided to the host by the storage device changes. If the logical address of any data stored in the original hidden mode changes, when the host tries to access the data based on the logical address recorded in the file system, the data will not be found using the logical address recorded in the file system. Therefore, to ensure that the host can still locate the corresponding data based on the logical address recorded in the file system even if the capacity provided by the storage device changes, the logical address of any data stored in the original hidden mode must remain unchanged. To ensure this, the host's hidden logical address space must be located after the host's visible logical address space.
[0094] For example, the size of one or more logical address ranges indicated by the Set Feature command and the size of the logical address space can be related as follows: the size of one or more logical address ranges indicated by the Set Feature command is less than or equal to the logical address space. As another example, in response to the storage device's operating mode being set to hidden mode, the size of the logical address space visible to the host is equal to the size of the logical address space excluding the one or more logical address ranges indicated by the Set Feature command; in response to the storage device's operating mode being set to normal mode, the size of the logical address space visible to the host is equal to the size of the one or more logical address ranges indicated by the Set Feature command.
[0095] Figure 3BThis illustration shows a schematic diagram of the mapping between the host logical address space and the device logical address space in hidden mode, as provided in an embodiment of this application. The host logical address space is the storage address space known and accessible to the host, while the device logical address space is the storage address space maintained and managed by the storage device. To enable the host to access the storage device through elements of the host logical address space, a certain mapping relationship exists between the host logical address space and the device logical address space. This mapping relationship is not static but dynamically changes depending on the operating mode of the storage device. Figure 3B In this context, the device's LBA space can include A1, A2, and A3. There is a mapping relationship between host logical address space 1 and A2, while A1 and A3 do not have corresponding host logical address spaces.
[0096] like Figure 3B As shown, when a storage device is in hidden mode, the relationship between the host logical address space and the device logical address space can be configured. A mapping relationship exists between the host logical address space and a portion of the device logical address space (e.g., a mapping relationship exists between host logical address space 1 and A2), while some device logical address spaces do not have corresponding host logical address spaces (e.g., A1 and A3 have no corresponding host logical addresses). Since the host accesses the storage device through the host logical addresses in the host logical address space, the host cannot access the portion of the device logical address space (A1 and A3) that does not have corresponding host logical addresses. For example, the host operating system, applications, or disk manager cannot access this portion of the device logical address space, thus enabling the storage device to hide a portion of its storage address space from the host, putting the storage device in hidden mode.
[0097] As an example, in response to setting the operating mode of a storage device, a capacity value A or a capacity value B can be set based on the host logical address space. Further, in response to setting the operating mode of the storage device to hidden mode, a capacity value B can be set based on host logical address space A; or in response to setting the operating mode of the storage device to normal mode, a capacity value A can be set based on host logical address space B. Here, host logical address space B includes host logical address space A and a newly added host logical address space. In hidden mode, the newly added host logical address space is not visible to the host. It can be understood that host logical address space A and host logical address space B are the storage address spaces known and accessible to the host in hidden mode and normal mode, respectively.
[0098] For example, the operating mode of a storage device can be set using a mode switching command or a Set Feature command. As one implementation, the command that triggers the storage device to adjust its operating mode is a mode switching command, which can set either capacity value A or capacity value B based on the host logical address space. In hidden mode, the size of the host logical address space is smaller than the size of the device logical address space. In normal mode, the size of the host logical address space is equal to the size of the device logical address space.
[0099] In another implementation, the command that triggers the storage device to adjust its operating mode is the Set Feature command. If the logical address range indicated by the Set Feature command describes the host logical address space, the operating mode of the storage device can be set to normal mode, and the storage capacity of the storage device in normal mode can be set to capacity value A based on the logical address range. If the logical address range indicated by the Set Feature command is a portion of the device's logical address space, and this portion of the device's logical address space does not have a corresponding host logical address space, the storage capacity of the storage device in hidden mode can be set to capacity value B based on the host logical address space. For example, the command that triggers the storage device to adjust its operating mode is the Set Feature command, and the operating mode is set to normal mode. The size of the logical address range indicated by the Set Feature command is less than or equal to the device's logical address space. As another example, in response to the operating mode being set to hidden mode, the size of the host logical address space is equal to the size of the logical address space of the device, excluding the one or more logical address ranges indicated by the Set Feature command; in response to the operating mode being set to normal mode, the size of the host logical address space is equal to the size of the one or more logical address ranges indicated by the Set Feature command.
[0100] Figure 3C This illustration shows a schematic diagram of the mapping between the host LBA space and the device LBA space in normal mode provided in an embodiment of this application.
[0101] exist Figure 3C In normal mode (specifically, the storage device can be set to normal mode using the mode switching command or the Set Feature command), by Figure 3BAs can be seen, in hidden mode, device LBA spaces A1 and A3 cannot be accessed by the host because they lack corresponding host logical address spaces. As discussed above, compared to hidden mode, in normal mode, the host can access not only the entire device LBA space (accessible in hidden mode), but also some or all of the device LBA spaces that are inaccessible in hidden mode. That is, in normal mode, the host can access not only LBA space A2, but also part or all of device LBA spaces A1 and / or device LBA spaces A3. The following explanation uses the example of the host being able to access all of device LBA spaces A1 and A3 in normal mode.
[0102] In order for the host to access device LBA space A1 and device LBA space A3, Figure 3C In normal mode, the host LBA space includes host LBA space 1 and host LBA space 2. Host LBA space 2 has a mapping relationship with device LBA spaces A1 and A3. Understandably, in hidden mode, some device LBA spaces A1 and A3 do not have corresponding host LBA spaces (e.g., ...). Figure 3B (As shown). In normal mode, some device LBA spaces A1 and A3 have a mapping relationship with host LBA space 2. In this case, host LBA space 2 can be understood as a newly added host LBA space when switching from hidden mode to normal mode. The host accesses device LBA spaces A1 and A3 through the newly added host LBA space 2. For example, the newly added host logical address space 2 is located after host logical address space 1 in the host logical address space, thus ensuring that when the capacity value provided by the storage device to the host changes, the host can still find the corresponding data based on the logical address of the data recorded in the existing file system.
[0103] As another example, in normal mode, the newly added host logical address space 2 is mapped to any location in the device logical address space that is not visible to the host (e.g., A1, A3). Therefore, after the storage device switches from hidden mode to normal mode, the addresses of the host LBA space remain unchanged in normal mode, while the newly added host LBA space can be mapped to any location in the device LBA space, thus removing the positional restrictions of the hidden space within the device LBA space. For example, if the address range of the host LBA space was 0-256GB in hidden mode, this range remains 0-256GB after switching from hidden mode to normal mode. Furthermore, the device LBA space managed by the storage device remains unchanged before and after the mode switch, isolating the changes in the host LBA space from the processing of the storage device's control components and avoiding the introduction of additional complexity.
[0104] The following combination Figures 4A to 4CThe process of setting the device LBA space using the Set Feature command is further explained.
[0105] Figure 4A This illustration shows a mapping diagram between the host LBA space and the device LBA space in another hidden mode provided by an embodiment of this application.
[0106] As one implementation, a host can describe whether part or all of a device's LBA space is accessible to the host by using one or more logical address ranges indicated by the Set Feature command. For example, such as... Figure 4A As shown, the device LBA space comprises three parts: device LBA space S1, device LBA space S2, and device LBA space S3. In hidden mode, the host uses the Set Feature command to indicate that device LBA space S1 can be accessed. To enable host access to device LBA space S1, a mapping relationship is established between device LBA space S1 and host LBA space 1 in the storage device. The host accesses device LBA space S1 through host LBA space 1. Additionally, the storage device's capacity can be set according to the logical address range indicated by the Set Feature command. Figure 4A In this context, because device LBA spaces S2 and S3 do not have corresponding host LBA spaces, the host operating system, applications, or disk manager cannot access device LBA spaces S2 and S3.
[0107] Figure 4B This illustration shows a schematic diagram of the mapping between the host LBA space and the device LBA space in another normal mode provided by an embodiment of this application.
[0108] For example, such as Figure 4B As shown, in normal mode, the host indicates that the device's LBA spaces S1 and S2 can be accessed via the Set Feature command, compared to... Figure 4A The hidden mode shown is in Figure 4B In this configuration, the host can access device LBA space S2. Furthermore, to enable host access to device LBA space S2, in addition to establishing a mapping between device LBA space S1 and host LBA space 1, a mapping between device LBA space S2 and host LBA space 2 is also established in the storage device. The host can access device LBA space S2 through the newly added host LBA space 2. However, since the Set Feature command does not indicate that device LBA space S3 can be accessed by the host, no corresponding host LBA space is set in the storage device for device LBA space S3. Therefore, the host operating system, applications, or disk manager cannot access S3.
[0109] Figure 4C This illustration shows a schematic diagram of the mapping between the host LBA space and the device LBA space in another normal mode provided by another embodiment of this application.
[0110] In another implementation, when using the Set Feature command to control the storage device's switch from hidden mode to normal mode, all or part of the device's LBA space can be made accessible to the host. For example, as shown in 4C, the storage device's provided LBA space includes four parts: S1, S2, S3, and S4. When the host instructs the storage device to switch to normal mode via the Set Feature command, it also indicates that S1, S2, and S4 are accessible to the host. Compared to... Figure 4A The hidden mode shown is in Figure 4C In this embodiment, the host can access device LBA spaces S2 and S4. To enable the host to access device LBA spaces S2 and S4, in addition to establishing a mapping relationship between device LBA space S1 and host LBA space 1, a mapping relationship is also established between device LBA spaces S2 and S4 and host LBA space 2. The host can access device LBA spaces S2 and S4 through the newly added host LBA space 2. At this time, the capacity value of the storage device can be set according to S1, S2, and S4 indicated by the Set Feature command. In addition, since the Set Feature command does not indicate that device LBA space S3 can be accessed by the host, S3 does not have a corresponding host LBA space, and the host operating system, applications, or disk manager cannot access S3. Therefore, even in normal mode, some hidden space can still be reserved that is not accessible to the host. In the solution provided by this application embodiment, when the host instructs the storage device to switch its working mode to normal mode through the Set Feature command, the Set Feature command can instruct the host to open some device LBA spaces that are inaccessible in hidden mode. In normal mode, some device LBA spaces of the storage device can still be inaccessible.
[0111] As an example, the host can further send a protocol-defined Identify command to the storage device. After receiving the Identify command, the storage device can return either capacity value A or capacity value B to the host. In one implementation, if the storage device's current operating mode is normal mode, it returns capacity value A to the host; if the storage device's current operating mode is hidden mode, it returns capacity value B to the host. For example, the storage device can change the size of the LBA space it provides to the host by changing the value of the parameter nsze, where the parameter nsze indicates the changed host LBA space size.
[0112] The Identify command can specify various command parameters. As an example, when the storage device does not support "NameSpace," an Identify command specifying the "NameSpace" parameter is used to obtain the storage capacity of the storage device, or further obtain additional information related to the hidden LBA space. Thus, the storage device's processing of Identify commands with other command parameters is not changed, ensuring the storage device meets the requirements for NVMe protocol compatibility. According to embodiments of this application, when the storage device processes an Identify command specifying the "NameSpace" parameter, information about the hidden logical address space is added to the result of the Identify command. Optionally, since the storage device does not support "NameSpace," the NSID of "NameSpace" is set to, for example, NS0 in an Identify command specifying the "NameSpace" parameter.
[0113] As another example, when using the Set Feature command indicating "LBA Range Type" as a mode switching command, the Get Feature command indicating "LBA Range Type" can be used accordingly to obtain the current operating mode of the storage device (normal mode or hidden mode), and optionally the size of the hidden LBA space. The Set Feature command indicating "LBA Range Type" is also registered to be associated with mode switching commands.
[0114] According to embodiments of this application, mode switching commands are indicated by custom commands or by existing commands in the standard, thereby providing new or different functions for the commands. The storage devices coupled to the host may come from different manufacturers or batches, and therefore may or may not support mode switching commands. Support is needed to assist the host in identifying whether the storage device supports mode switching commands. As another example, the effects of commands sent by the host to the storage device, such as NVMe commands or custom commands, can be reflected through a Log page. A "Log Page" is a data structure defined by the NVMe protocol that reflects the effects of the storage device processing each command. The data corresponding to each command in the "Log Page" reflects the differences in the effects of command processing between different storage devices. For example, one storage device may change its storage capacity after processing a SetFeature command indicating "LBA Range Type," while another storage device may not; or, for another example, one storage device may change its storage capacity after processing a custom mode switching command, while another storage device may not support the custom mode switching command. Therefore, the effects of commands can be obtained through the Log page to identify whether one or more storage devices connected to the host support hiding portions of the logical address space. Specifically, the host sets an identifier for mode-switching commands in the Log page to indicate the effects of the mode-switching commands, and returns the relevant identifier when it receives a GetLog Page command in the NVMe protocol (to retrieve the Log page of the corresponding mode-switching command). For example, in the data of the corresponding mode-switching command in the Log Page, the CSUPP / LBCC / NCC / NIC / CCC / CSE fields specified by the NVMe protocol are all set to 1.
[0115] In an optional implementation, during the issuance of an I / O command to a storage device in hidden mode, if the address of the storage space accessed in the I / O command after the specified location exceeds the storage address space range of the storage device, the host's storage device driver will refuse to issue the I / O command to the storage device to avoid errors and unnecessary command sending and processing, effectively saving system resources. Optionally or further, if, for some reason (e.g., virus infection), the host issues an I / O command to the hidden mode storage device to access the hidden LBA space, the storage device will also refuse to process such I / O commands and report an error to the host, such as an out-of-bounds logical address access error.
[0116] Optionally, the storage device may refuse to process erase and / or format commands to the hidden LBA space to protect the data in that space. For example, in hidden mode, the storage device refuses to process erase and / or format commands to the hidden LBA space; while in normal mode, the storage device may execute erase and / or format commands to the hidden LBA space after verifying the host's permissions, and delete the data in the hidden LBA space in response. In yet another example, after the storage device is manufactured and the required data is written to the hidden LBA space, it may never accept erase and / or format commands from the host to ensure the continued availability of the data in the hidden LBA space. Understandably, for wear leveling, data reliability, and other requirements, the control unit within the storage device may perform garbage collection on the physical address corresponding to the hidden LBA space, but ensure the validity of the data in the hidden LBA space.
[0117] As an example, the storage device can be further configured to operate in a hidden mode at the factory. In one implementation, the storage device can be set to hidden mode during the manufacturing stage and delivered to the customer, who then installs it on the host. Optionally, in hidden mode, both a logical address space visible to the host and a hidden logical address space are configured. As an example, the hidden logical address space can further store data required for the host to restore factory settings, antivirus programs, etc.
[0118] As another example, if the storage device is powered off and then powered on again, its operating mode can be switched to hidden mode or retained as it was before power-off. In one implementation, the storage device's operating mode can be set to the mode indicated by the mode switching command after power-on. For example, the mode switching command can indicate the operating mode after the next power-on. When the storage device is powered on again, its operating mode can be directly set to hidden mode or normal mode according to the mode switching command.
[0119] As another implementation, the operating mode after power-on can also be recorded in the controller or non-volatile memory (NVM). After the storage device is powered on again, the operating mode of the storage device is set according to the recorded hidden mode or normal mode.
[0120] As another implementation method, the operating mode to be used can be obtained directly when the storage device starts up, and the operating mode of the storage device can be set according to the obtained hidden mode or normal mode.
[0121] Optionally, the operating mode of the storage device (hidden mode or normal mode) should not change due to power-on / off. Alternatively, a hidden mode-first approach can be adopted: storage devices in hidden mode remain in hidden mode after a restart; while storage devices in normal mode enter hidden mode after a restart, thus improving the security of the hidden LBA space. After power-on / off or restart of the storage device, information such as the size of the hidden LBA space and Log Page remains unchanged.
[0122] This application also provides a storage controller for implementing... Figure 2A The related solutions are as follows. In addition, this application also provides a storage device that includes the aforementioned storage controller.
[0123] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application. Clearly, those skilled in the art can make various alterations and variations to this application without departing from its spirit and scope. Thus, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A method for managing storage devices, characterized in that, include: In response to receiving a command that triggers the storage device to adjust its operating mode, the operating mode of the storage device is set, wherein the operating mode includes a normal mode and a hidden mode; In response to setting the operating mode of the storage device, a value for indicating the storage capacity of the storage device is also set; wherein the value of the storage capacity of the storage device indicated by the hidden mode is different from that of the normal mode; Setting a value to indicate the storage capacity of the storage device includes: In response to setting the storage device to normal mode, the storage capacity of the storage device in normal mode is set to a first capacity value; or In response to setting the storage device to a hidden mode, the storage capacity of the storage device in the hidden mode is set to a second capacity value, wherein the first capacity value is different from the second capacity value; The first capacity value or the second capacity value is set according to the logical address space visible to the host, wherein the logical address space visible to the host is the storage address space reported by the storage device to the host and accessed by the host as a block device; The logical address space is the storage address space provided by the storage device, and the host uses the logical address, which is an element of the logical address space, to access the storage device.
2. The method according to claim 1, characterized in that, Setting the storage device to normal mode or hidden mode includes: In response to the command being a mode switching command, if the current operating mode of the storage device is the normal mode, then the operating mode of the storage device is switched from the normal mode to the hidden mode; If the current operating mode of the storage device is the hidden mode, then the operating mode of the storage device is switched from the hidden mode to the normal mode.
3. The method according to claim 1, characterized in that, In response to the Set Feature command defined by the NVMe protocol, the operating mode of the storage device and the storage capacity of the storage device are set according to one or more logical address ranges indicated by the Set Feature command.
4. The method according to any one of claims 1 to 2, wherein the device logical address space is a storage address space provided by the storage device, the host accesses the storage device using elements of the host logical address space, and for processing I / O commands provided by the host, the storage device converts elements of the host logical address space in the I / O commands into elements of the device logical address space, characterized in that... Setting a value for indicating the storage capacity of the storage device further includes: In response to setting the operating mode of the storage device, the first capacity value or the second capacity value is set based on the host logical address space, wherein the host logical address space is the storage address space reported by the storage device to the host and accessed by the host as a block device.
5. The method according to claim 4, characterized in that, Setting the first capacity value or the second capacity value based on the host logical address space includes: In response to setting the operating mode of the storage device to a hidden mode, the second capacity value is set based on the first host logical address space; or In response to setting the operating mode of the storage device to normal mode, a first capacity value is set based on a second host logical address space, wherein the second host logical address space includes the first host logical address space and the newly added host logical address space, and in the hidden mode, the newly added host logical address space is not visible to the host.
6. The method according to claim 5, characterized in that, The newly added host logical address space in the second host logical address space is located after the first host logical address space.
7. The method according to claim 1, characterized in that, The method further includes: In response to receiving an IO command, the logical address accessed by the IO command is obtained; and If the logical address accessed by the IO command exceeds the logical address space visible to the host, or if the logical address of the host accessed by the IO command exceeds the host's logical address space, an error message is returned.
8. A storage controller, characterized in that, The storage controller is used to implement the method for managing storage devices as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Method and system for hiding data on removable storage equipment
CN110489357A
