Storage device management method and device, equipment and storage medium
By quickly determining the physical connection status of the storage device through the in-place status detection pin, the access blocking problem caused by multiple attempts by the SATA controller to establish a link is solved, and access to other storage devices can be quickly restored, reducing data loss and hardware costs.
Patent Information
- Application Number
- CN202410285827.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-13
- Publication Date
- 2025-09-16
AI Technical Summary
In the prior art, when a SATA controller detects that a storage device is unplugged, it will attempt to establish a communication link multiple times, resulting in access to other storage devices being blocked, causing a significant impact.
By using detection pins (such as GPIO pins) to detect the presence status of the storage device, it is quickly determined whether the storage device is physically disconnected from the SATA PM, thereby reducing the impact on other storage devices.
This allows for quick determination of the status of a storage device when it is unplugged, reduces the duration of access blockage to other storage devices, reduces the risk of data loss, and reduces hardware costs.
Smart Images

Figure CN120653589A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of storage technology, and in particular to a storage device management method, apparatus, device, and storage medium. Background Art
[0002] To expand the storage capacity of electronic devices, multiple storage devices can be connected to a SATA controller via a serial advanced technology attachment port multiplier (SATA PM). In this way, data can be stored in any storage device through the SATA controller to meet data storage needs.
[0003] When one of the multiple storage devices connected to a SATA PM is unplugged, the SATA controller detects a disconnected communication link with the unplugged storage device and initiates a link failure troubleshooting process. During this process, the SATA controller attempts to establish a communication link with the unplugged storage device multiple times. During these attempts, the controller blocks access to other storage devices connected to the SATA PM. If these attempts fail, the controller determines that the storage device is unplugged and restores access to other storage devices.
[0004] During the process of establishing communication links multiple times, the SATA controller will block access to other storage devices connected to the SATA PM, thus having a significant impact on other storage devices. Summary of the Invention
[0005] The present application provides a storage device management method, apparatus, device and storage medium, which can quickly determine that a storage device is unplugged when the communication link between a SATA controller and a storage device is disconnected, thereby reducing the impact on other storage devices.
[0006] In a first aspect, a storage device management method is provided, the method being used to manage multiple storage devices in an electronic device, the electronic device comprising a SATA controller, a SATA PM, the aforementioned multiple storage devices, and multiple detection pins, the SATA PM being connected to the SATA controller, each storage device being connected to a port of the SATA PM, and each storage device being connected to at least one detection pin among the aforementioned multiple detection pins. The management method comprises: determining that a communication link between a first storage device and the SATA controller is disconnected, the first storage device being any storage device among the multiple storage devices; determining an in-place status of the first storage device, the in-place status of the first storage device being used to indicate whether the first storage device is physically disconnected from the SATA PM, the in-place status of the first storage device being detected by the detection pin connected to the first storage device; and determining that the first storage device is unplugged in response to determining that the in-place status of the first storage device indicates that the first storage device is physically disconnected from the SATA PM.
[0007] In the present application, when the SATA controller determines that the communication link between the first storage device and the SATA controller is disconnected, it first determines whether the physical connection between the first storage device and the SATA PM is disconnected based on the presence status of the first storage device detected by the detection pin connected to the first storage device. When the physical connection between the first storage device and the SATA PM is disconnected, it determines that the first storage device is unplugged. In this way, the SATA controller can quickly determine that the first storage device is unplugged without having to attempt to establish a communication link with the first storage device multiple times. The detection pin is equivalent to a physical detection channel for the presence status of the storage device. Through this physical detection channel, whether the storage device is in place can be directly determined, with high detection efficiency and accurate detection results.
[0008] Optionally, the detection pin is a general-purpose input / output (GPIO) pin. Using the GPIO pin as the detection pin has low implementation cost and accurate detection results.
[0009] In one possible implementation, the electronic device further includes an auxiliary controller connected to the plurality of detection pins, and configured to record status information of the first storage device based on the levels of the detection pins connected to the first storage device, the status information of the first storage device being configured to indicate an in-place status of the first storage device. Determining the in-place status of the first storage device includes obtaining the status information of the first storage device from the auxiliary controller.
[0010] By providing an auxiliary controller to collect status information of each storage device, and then the SATA controller obtains the status information of the first storage device from the auxiliary controller, the SATA controller and the auxiliary controller can interact through various communication methods, thereby reducing the difficulty of assembling the electronic device. Here, the electronic device includes a mainboard and a backplane, the auxiliary controller and the detection pins are located on the backplane, and the SATA controller is located on the mainboard. The difficulty of assembling the electronic device may refer to the difficulty of coupling the mainboard and the backplane.
[0011] Optionally, the SATA controller obtains the status information of the first storage device from the auxiliary controller, including: obtaining the status information of the first storage device from the auxiliary controller using an inter-integrated circuit (I2C) interface, a peripheral component interconnect express (PCIe) interface, a universal asynchronous receiver / transmitter (UART) interface, or a network interface. During implementation, an appropriate communication interface can be selected as needed to enable information exchange between the SATA controller and the auxiliary controller.
[0012] Optionally, the auxiliary controller is a single chip microcomputer or a GPIO expander. Using these two devices as the auxiliary controller is relatively easy to implement.
[0013] In another possible implementation, determining the presence status of the first storage device includes determining the presence status of the first storage device based on the level of a detection pin connected to the first storage device. In this implementation, the processor directly determines the presence status of the corresponding storage device based on the level of the detection pin, which can reduce the time required to detect the presence status and further shorten the blocking period for other storage devices.
[0014] Optionally, the method further includes: in response to determining that the in-place status of the first storage device indicates that the first storage device is physically connected to the SATA PM, attempting to establish a communication link with the first storage device. If the in-place status of the first storage device indicates that the first storage device is physically connected to the SATA PM, this indicates that the first storage device has not been unplugged, and the abnormality of the first storage device may be resolved by re-establishing the communication link.
[0015] Optionally, the method further includes: after determining that the first storage device is unplugged, accessing a second storage device, where the second storage device is a storage device different from the first storage device among the plurality of storage devices. In this way, access to the other storage devices can be restored as quickly as possible, reducing the duration of access blocking the other storage devices.
[0016] In a second aspect, a storage device management device is provided, which is used to manage multiple storage devices in an electronic device. For relevant contents of the electronic device, see the first aspect. The device includes: a first determination module, a second determination module, and a management module. The first determination module is used to determine whether the communication link between a first storage device and the SATA controller is disconnected, and the first storage device is any storage device among the multiple storage devices. The second determination module is used to determine the in-place status of the first storage device, and the in-place status of the first storage device is used to indicate whether the first storage device is physically disconnected from the SATA PM, and the in-place status of the first storage device is detected by the detection pin connected to the first storage device. The management module is used to determine that the first storage device is unplugged in response to determining that the in-place status of the first storage device indicates that the first storage device is physically disconnected from the SATA PM.
[0017] Optionally, the electronic device further comprises a plurality of detection pins, and any storage device among the plurality of storage devices is connected to at least one of the plurality of detection pins. The second determination module is configured to determine the presence status of the first storage device through the detection pin connected to the first storage device.
[0018] Optionally, the electronic device further includes an auxiliary controller connected to the plurality of detection pins, and configured to record status information of the first storage device based on the levels of the detection pins connected to the first storage device, the status information of the first storage device being configured to indicate an in-place status of the first storage device. The second determination module is configured to obtain the status information of the first storage device from the auxiliary controller.
[0019] Optionally, the second determining module is configured to obtain the status information of the first storage device from the auxiliary controller using an integrated circuit bus I2C interface, a peripheral component interconnect PCIe interface, a universal asynchronous receiver / transmitter UART interface, or a network interface.
[0020] Optionally, the second determining module is configured to determine the presence status of the first storage device according to a level of a detection pin connected to the first storage device.
[0021] Optionally, the management module is further configured to attempt to establish a communication link with the first storage device in response to determining that the presence status of the first storage device indicates that the first storage device is not physically disconnected from the SATA PM.
[0022] Optionally, the apparatus further includes: an access module, configured to access a second storage device after determining that the first storage device is unplugged, where the second storage device is a storage device different from the first storage device among the multiple storage devices.
[0023] In a third aspect, a computer device is provided, comprising: a processor, the processor being coupled to a memory, the memory storing at least one program instruction or code, the at least one program instruction or code being loaded and executed by the processor, so that the computer device implements the storage device management method as described in any one of the first aspects above.
[0024] Optionally, there are one or more processors, and the processor is a multi-core processor, and there are one or more memories.
[0025] Optionally, the memory may be integrated with the processor, or the memory may be provided separately from the processor.
[0026] In the specific implementation process, the memory can be a non-transitory memory, such as a read-only memory (ROM), which can be integrated on the same chip as the processor or be set on different chips. This application does not limit the type of memory and the setting method of the memory and the processor.
[0027] In a fourth aspect, a computer-readable storage medium is provided, wherein the storage medium stores at least one instruction, and the instruction is loaded and executed by a processor to enable a computer to implement the method in the above-mentioned first aspect or any possible implementation of the first aspect.
[0028] In a fifth aspect, a computer program (product) is provided, which includes: computer program code, which, when executed by a computer, enables the computer to execute the method in the first aspect.
[0029] In a sixth aspect, a chip is provided, comprising a processor for calling and executing instructions stored in a memory from the memory, so that a computer device equipped with the chip executes the method in the first aspect above.
[0030] In the seventh aspect, another chip is provided, comprising: an input interface, an output interface, a processor and a memory, wherein the input interface, the output interface, the processor and the memory are connected via an internal connection path, and the processor is used to execute the code in the memory. When the code is executed, the processor is used to execute the method in the above-mentioned first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0032] Figure 2 This is a flowchart of a storage device management method provided by an embodiment of the present application;
[0033] Figure 3 is a structural diagram of another electronic device provided in an embodiment of the present application;
[0034] Figure 4 This is a structural diagram of a storage device management device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0035] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.
[0036] Figure 1 Schematic diagram of the structure of an electronic device provided by an embodiment of the present application. The electronic device may be a computer device such as a server or an embedded desktop box device. The server may be a storage server, etc., and the embedded desktop box device may be a network video recorder (NVR), etc. Figure 1 As shown, the electronic device includes a processor, a memory, a SATA controller, at least one SATA PM and multiple storage devices.
[0037] The SATA controller has one or more ports, each port is connected to a SATA PM. Each SATA PM is connected to one or more storage devices, and the number of storage devices connected to different SATA PMs can be the same or different. For example, Figure 1 In the example, the SATA controller has four ports, each of which is connected to a SATA PM. Each SATA PM is connected to four storage devices. For example, SATA PM 0 is connected to storage devices 0-3, SATA PM 1 is connected to storage devices 4-7, SATA PM 2 is connected to storage devices 8-11, and SATA PM 3 is connected to storage devices 12-15.
[0038] It should be noted that the embodiments of the present application do not limit the number of storage devices connected to each SATA PM; this number may be determined by the SATA PM model. For example, the maximum number of storage devices connected to each SATA PM may be 2-16, for example, 4-8. The number of storage devices connected to different SATA PM models may be the same or different.
[0039] The processor can write data to or read data from any storage device via the SATA PM through the SATA controller. Optionally, the storage device is a hard disk, such as a mechanical hard disk drive (HDD) or a solid state drive (SSD).
[0040] The processor may include any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0041] The memory may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. Non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory may be random access memory (RAM), which is used as an external cache memory. By way of example and not limitation, many forms of RAM are available. For example, static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct memory bus random access memory (DR RAM).
[0042] The memory stores executable program code, and the processor executes the executable program code to implement the functions of the first determination module, the second determination module, and the management module described below, thereby implementing the storage device management method. In other words, the memory stores instructions for executing the storage device management method.
[0043] like Figure 1 As shown, the electronic device includes a backplane and a mainboard. The backplane includes multiple slots. Each slot is used to plug in a storage device. SATA PMs are provided on the backplane, and each SATA PM is connected to multiple slots. When a storage device is inserted into a slot, it connects to the corresponding SATA PM. The processor, memory, and SATA controller are provided on the mainboard.
[0044] For example, the processor, memory, and SATA controller may be integrated into a system on chip (SoC).
[0045] The electronic device supports hot plugging of storage devices in the slots. Take the unplugging of storage device 0 as an example. When storage device 0 is unplugged, the SATA controller detects that the communication link with storage device 0 is disconnected, and enters the link abnormality fault handling process. In the link abnormality fault handling process, the SATA controller attempts to re-establish the communication link with storage device 0. When multiple attempts to establish a communication link fail, it is determined that storage device 0 is unplugged. According to the provisions of the SATA protocol, the SATA controller will process access to each storage device 0 in turn. Therefore, during the process of the SATA controller repeatedly attempting to establish a communication link, it will stop accessing other storage devices. In this case, if there is data that needs to be stored, it will not be written to the storage device in time, resulting in data loss.
[0046] In the related art, a large buffer is set in the electronic device to temporarily store data during the process of trying to establish a communication link to avoid data loss. However, setting a large buffer will result in higher hardware costs for the electronic device.
[0047] To this end, embodiments of the present application provide a storage device management method that can quickly determine when a storage device has been unplugged, thereby shortening the blocking time for access to other storage devices. This reduces the waiting time for data to be written to the storage device when a large amount of data needs to be stored, thereby minimizing the possibility of data loss without requiring a large cache.
[0048] Figure 2 This is a flow chart of a storage device management method provided by an embodiment of the present application. Figure 1 The electronic device in the electronic device is executed, for example, by a processor in the electronic device. Figure 2 As shown, the method includes:
[0049] 201: Determine that a communication link between a first storage device and a SATA controller is disconnected.
[0050] The first storage device is any storage device in the electronic device. Therefore, any storage device may be unplugged. When the first storage device is unplugged, the physical connection between the first storage device and the SATA PM is disconnected, and accordingly, the communication link between the first storage device and the SATA controller is disconnected.
[0051] The SATA controller has a register that records the link status between each SATA controller and each storage device. Different bits of the register in the SATA controller are used to indicate the link status between different storage devices and the SATA controller.
[0052] The processor can determine the link status between the first storage device and the SATA controller by obtaining the value of a register in the SATA controller. For example, the register is a 16-bit register, and bits 1 to 16 of the register are used to represent the link status between storage devices 0 to 15 and the SATA controller, respectively. When the value of a bit in the register is a first value, it indicates that the link status between the corresponding storage device and the SATA controller is a disconnected communication link; when the value of a bit in the register is a second value, it indicates that the link status between the corresponding storage device and the SATA controller is an intact communication link. Optionally, the first value is 0 and the second value is 1; or, the first value is 1 and the second value is 0.
[0053] After determining that the communication link between the first storage device and the SATA controller is disconnected, according to the SATA protocol, a link abnormality fault handling process is entered.
[0054] 202: Determine the presence status of the first storage device.
[0055] The presence status of the first storage device is used to indicate whether the first storage device is physically disconnected from the SATA PM.
[0056] 203 : In response to determining that the presence status of the first storage device indicates that the first storage device is physically disconnected from the SATA PM, determine that the first storage device is unplugged.
[0057] In an embodiment of the present application, when the SATA controller determines that the communication link between the first storage device and the SATA controller is disconnected, it first determines whether the physical connection between the first storage device and the SATA PM is disconnected based on the in-place status of the first storage device detected by the detection pin connected to the first storage device. When the physical connection between the first storage device and the SATA PM is disconnected, it determines that the first storage device is unplugged. In this way, the SATA controller can quickly determine that the first storage device is unplugged without having to make multiple attempts to establish a communication link with the first storage device. After the processing flow related to the first storage device is completed, access to other storage devices can be restored. Since there is no need to wait for multiple attempts to establish a communication link with the first storage device, the blocking time for access to other storage devices is shortened, which can reduce the impact of the unplugging of the first storage device on other storage devices corresponding to the SATA PM to which the first storage device is connected. In the process of storing large amounts of data, the phenomenon of data loss can be effectively reduced.
[0058] Optionally, the method further includes: in response to determining that the in-place status of the first storage device indicates that the first storage device is physically connected to the SATA PM, attempting to establish a communication link with the first storage device. If the in-place status of the first storage device indicates that the first storage device is physically connected to the SATA PM, this indicates that the first storage device has not been unplugged, and the abnormality of the first storage device may be resolved by re-establishing the communication link.
[0059] After determining that the first storage device is unplugged, the link abnormality troubleshooting process ends, and access to other storage devices connected to the SATA PM corresponding to the first storage device is restored. Optionally, the method further includes: after determining that the first storage device is unplugged, accessing a second storage device. The second storage device is a storage device among the multiple storage devices that is different from the first storage device. This allows access to other storage devices to be restored as quickly as possible, reducing the duration of access congestion to other storage devices.
[0060] Optionally, accessing the second storage device includes writing data to be stored into the second storage device, and / or reading data from the second storage device.
[0061] The following describes how to determine the presence status of the first storage device.
[0062] Alternatively, as Figure 1 As shown, the electronic device further includes a plurality of detection pins (also referred to as detection pins or detection pins), each storage device is connected to at least one detection pin, and different storage devices are connected to different detection pins. In 202, the presence status of the first storage device is determined based on the detection pin connected to the first storage device.
[0063] Optionally, each storage device is connected to a detection pin. In this way, the presence status of each storage device can be determined by a relatively small number of detection pins.
[0064] In some examples, when the level of the detection pin is high, it indicates that the storage device connected to the detection pin is in place; when the level of the detection pin is low, it indicates that the storage device connected to the detection pin is not in place. In other examples, when the level of the detection pin is low, it indicates that the storage device connected to the detection pin is in place; when the level of the detection pin is high, it indicates that the storage device connected to the detection pin is not in place.
[0065] The detection pin is provided on the backplane and is located in the corresponding slot so as to connect with the storage device inserted in the slot. Here, "in place" means that the storage device is inserted in the corresponding slot, and "out of place" means that the storage device is not inserted in the corresponding slot.
[0066] The detection pin is equivalent to a physical detection channel for the storage device's in-place status. Through this physical detection channel, whether the storage device is in place can be directly determined, with high detection efficiency and accurate detection results.
[0067] For example, the detection pin is a GPIO pin. Using the GPIO pin as the detection pin can achieve low cost and accurate detection results.
[0068] In a first possible implementation, Figure 1 As shown, the electronic device further includes an auxiliary controller connected to a plurality of detection pins. The auxiliary controller is configured to record status information of the first storage device based on the levels of the detection pins connected to the first storage device. The status information of the first storage device is configured to indicate the presence of the first storage device. In this case, determining the presence of the first storage device using the detection pins connected to the first storage device includes obtaining the status information of the first storage device from the auxiliary controller.
[0069] In this embodiment, an auxiliary controller is set up to collect status information of each storage device, and then the SATA controller obtains the status information of the first storage device from the auxiliary controller. The SATA controller and the auxiliary controller can interact through multiple communication methods, which can reduce the difficulty of coupling the main board and the backplane.
[0070] The status information of the first storage device may be a first value or a second value, wherein the first value indicates that the storage device is in place and the second value indicates that the storage device is not in place. In some examples, the first value is 0 and the second value is 1; in other examples, the first value is 1 and the second value is 0.
[0071] Optionally, a register is provided in the auxiliary controller, and the register is used to record status information of each storage device.
[0072] Exemplarily, the number of bits of the register in the auxiliary controller is equal to the number of ports of the SATA PM connected to the SATA controller, and each bit of the register is used to record status information of a corresponding storage device.
[0073] In order to facilitate connection with the detection pin to determine the level of the detection pin, the auxiliary controller can be set on the backplane.
[0074] Optionally, the processor uses an I2C interface, a PCIe interface, a UART interface, or a network interface to obtain the status information of the first storage device from the auxiliary controller. The embodiment of the present application does not limit the information exchange method between the SATA controller and the auxiliary controller, and can be selected according to actual needs. When the processor obtains the status information of the first storage device from the auxiliary controller through the communication interface, the mainboard of the electronic device is also provided with a controller corresponding to the communication interface. For example, Figure 1 In the embodiment, when the processor obtains the status information of the first storage device from the auxiliary controller via the I2C interface, the mainboard of the electronic device is further provided with an I2C controller. For another example, in other embodiments, when the processor obtains the status information of the first storage device from the auxiliary controller via the PCIe interface, the mainboard of the electronic device is further provided with a PCIe controller.
[0075] Optionally, the auxiliary controller includes but is not limited to a single chip microcomputer or a GPIO expander. Using these two devices as the auxiliary controller is relatively easy to implement.
[0076] For example, the GPIO expander is a PCA9555 chip. The PCA9555 chip is a high-performance, low-power GPIO expander that provides 16 GPIO channels, each of which can be individually configured as input or output. The PCA9555 chip communicates with the SATA controller via an I2C interface.
[0077] For example, for a Linux system, since the link abnormality fault handling process is executed in kernel mode, and obtaining the status information of the first storage device from the auxiliary controller is executed in user mode, in order to achieve the connection between user mode and kernel mode, the processor periodically obtains the status information of each storage device from the register of the auxiliary controller and saves the status information of each storage device in memory. In this way, when the processor executes the link abnormality fault handling process, it can obtain the status information of the first storage device from the memory, thereby determining the in-place status of the first storage device. Here, the memory is equivalent to the interaction middle layer between kernel mode and user mode.
[0078] Here, the processor periodically obtains the status information of each storage device from the register of the auxiliary controller, which means that the processor obtains the status information of each storage device from the register of the auxiliary controller at a set time interval. The length of the time interval can be set according to actual needs, for example, 0.1 seconds to 1 second.
[0079] Figure 3 This is a schematic diagram of the structure of another electronic device provided in an embodiment of the present application. Figure 3 As shown, Figure 1 The difference between the electronic devices shown is that Figure 3 The electronic device does not include the aforementioned auxiliary controller, and the processor is directly connected to the detection pin.
[0080] In this way, the processor can directly determine the presence status of the corresponding storage device according to the level of the detection pin. The relationship between the level of the detection pin and the presence status of the storage device is shown in the first possible implementation method mentioned above.
[0081] In this embodiment, the processor directly determines the presence status of the corresponding storage device according to the level of the detection pin, which can reduce the time consumption of the presence status detection and further shorten the blocking time of other storage devices.
[0082] In this embodiment, the detection pin is a GPIO pin.
[0083] The effect of the method of the embodiment of the present application is described below by taking NVR as an example. Assume that the recording specification of the NVR is 128 video streams and the video bit rate is 4Mbps. In the related art, in the process of waiting for the communication link with the first storage device to be re-established, the access to other storage devices needs to be blocked for at least 10 seconds. Therefore, it is necessary to reserve a 10-second video buffer and a memory buffer of approximately 640MB. By adopting the method provided in the embodiment of the present application, the blocking time of access to other storage devices can be reduced to 3 seconds, and the demand for memory buffer is reduced by 70%. Therefore, the embodiment of the present application can effectively reduce the hardware cost of electronic equipment. At the same time, there are no obvious breakpoints or skip seconds in the recorded video, indicating that there is no data loss.
[0084] An embodiment of the present application further provides a storage device management device, which is used to manage multiple storage devices in the aforementioned electronic device. Figure 4 This is a schematic diagram of the structure of a storage device management device provided by an embodiment of the present application. The management device can be implemented as all or part of an electronic device through software, hardware, or a combination of both. Figure 4 As shown, the apparatus 400 includes: a first determination module 401, a second determination module 402, and a management module 403. The first determination module 401 is configured to determine whether a communication link between a first storage device and the SATA controller is disconnected, where the first storage device is any one of the multiple storage devices. The second determination module 402 is configured to determine the in-place status of the first storage device, where the in-place status of the first storage device indicates whether the first storage device is physically disconnected from the SATA PM. The management module 403 is configured to determine that the first storage device is unplugged in response to determining that the in-place status of the first storage device indicates that the first storage device is physically disconnected from the SATA PM.
[0085] Optionally, the electronic device further includes a plurality of detection pins, and any storage device among the plurality of storage devices is connected to at least one of the plurality of detection pins. The second determination module 402 is configured to determine the presence status of the first storage device via the detection pin connected to the first storage device, where the presence status of the first storage device is detected via the detection pin connected to the first storage device.
[0086] Optionally, the electronic device further includes an auxiliary controller connected to the plurality of detection pins, and the auxiliary controller is configured to record status information of the first storage device based on the levels of the detection pins connected to the first storage device, where the status information of the first storage device is configured to indicate an in-place status of the first storage device. The second determining module 402 is configured to obtain the status information of the first storage device from the auxiliary controller.
[0087] Optionally, the second determining module 402 is configured to obtain the status information of the first storage device from the auxiliary controller by using an integrated circuit bus I2C interface, a peripheral component interconnect PCIe interface, a universal asynchronous receiver / transmitter UART interface, or a network interface.
[0088] Optionally, the second determining module 402 is configured to determine the presence status of the first storage device according to a level of a detection pin connected to the first storage device.
[0089] Optionally, the management module 403 is further configured to attempt to establish a communication link with the first storage device in response to determining that the presence status of the first storage device indicates that the first storage device is physically connected to the SATA PM.
[0090] Optionally, the apparatus further includes: an access module 404, configured to access a second storage device after determining that the first storage device is unplugged, where the second storage device is a storage device different from the first storage device among the multiple storage devices.
[0091] It should be noted that the storage device management apparatus provided in the above embodiment only uses the division of the above-mentioned functional units as an example to illustrate the management of the storage device. In actual applications, the above-mentioned functions can be assigned to different functional units as needed, that is, the internal structure of the device can be divided into different functional units to complete all or part of the functions described above. In addition, the storage device management apparatus provided in the above embodiment and the storage device management method embodiment are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0092] The descriptions of the processes corresponding to the above figures have different focuses. For parts that are not described in detail in a certain process, please refer to the relevant descriptions of other processes.
[0093] An embodiment of the present application also provides an electronic device, which includes a memory and a processor, wherein the memory is used to store computer instructions; the processor is used to execute the computer instructions stored in the memory, so that the electronic device executes the storage device management method in the above embodiment.
[0094] In some embodiments, a computer-readable storage medium is also provided, which stores computer instructions. When the computer instructions stored in the computer-readable storage medium are executed by an electronic device, the electronic device executes the storage device management method provided by the above method embodiment.
[0095] In some embodiments, a computer program product is also provided, which includes one or more computer program instructions. When the computer program instructions are loaded and executed by a computer, the computer executes the storage device management method provided by the above method embodiment.
[0096] In some embodiments, a chip is also provided, including a memory and a processor, wherein the memory is used to store computer instructions, and the processor is used to call and run the computer instructions from the memory to execute the storage device management method provided by the above method embodiment.
[0097] An embodiment of the present application also provides another chip, including: an input interface, an output interface, a processor and a memory, wherein the input interface, the output interface, the processor and the memory are connected via an internal connection path, and the processor is used to execute the code in the memory. When the code is executed, the processor is used to execute any of the storage device management methods described above.
[0098] The above description is only a specific implementation method of the present application, but the scope of protection of the present application is not limited thereto. Any technician familiar with this technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the scope of protection of the present application.
Claims
1. A storage device management method, characterized in that: Used to manage multiple storage devices in an electronic device, the electronic device comprising a Serial Advanced Technology Attachment (SATA) controller, a Serial Advanced Technology Attachment (SATA) port multiplexer (SATA PM), the multiple storage devices, and a plurality of detection pins, the SATA PM being connected to the SATA controller, any one of the multiple storage devices being connected to a port of the SATA PM, and any one of the multiple storage devices being connected to at least one detection pin of the multiple detection pins; The management method includes: Determining that a communication link between a first storage device and the SATA controller is disconnected, where the first storage device is any storage device among the multiple storage devices; Determine an in-place status of the first storage device, where the in-place status of the first storage device is used to indicate whether the first storage device is physically disconnected from the SATA PM, and the in-place status of the first storage device is detected by a detection pin connected to the first storage device; In response to determining that the presence status of the first storage device indicates that the first storage device is physically disconnected from the SATA PM, it is determined that the first storage device is unplugged.
2. The method according to claim 1, characterized in that The electronic device further includes an auxiliary controller connected to the plurality of detection pins, and the auxiliary controller is configured to record status information of the first storage device according to the levels of the detection pins connected to the first storage device, wherein the status information of the first storage device is configured to indicate an in-place status of the first storage device; The determining the in-place status of the first storage device includes: The status information of the first storage device is obtained from the auxiliary controller.
3. The method according to claim 2, characterized in that The acquiring the status information of the first storage device from the auxiliary controller includes: The status information of the first storage device is obtained from the auxiliary controller using an integrated circuit bus I2C interface, a peripheral component interconnect PCIe interface, a universal asynchronous receiver / transmitter UART interface, or a network interface.
4. The method according to claim 3, characterized in that The auxiliary controller is a single chip microcomputer or a general purpose input and output (GPIO) expander.
5. The method according to claim 2, characterized in that The determining the in-place status of the first storage device includes: The presence status of the first storage device is determined according to the level of the detection pin connected to the first storage device.
6. The method according to any one of claims 1 to 5, characterized in that The method further comprises: In response to determining that the presence status of the first storage device indicates that the first storage device is not physically disconnected from the SATA PM, attempting to establish a communication link with the first storage device.
7. The method according to any one of claims 1 to 6, characterized in that The method further comprises: After determining that the first storage device is unplugged, a second storage device is accessed, where the second storage device is a storage device different from the first storage device among the plurality of storage devices.
8. A storage device management device, characterized in that: Used to manage multiple storage devices in an electronic device, the electronic device comprising a Serial Advanced Technology Attachment (SATA) controller, a Serial Advanced Technology Attachment (SATA) port multiplexer (SATA PM), the multiple storage devices, and a plurality of detection pins, the SATA PM being connected to the SATA controller, any one of the multiple storage devices being connected to a port of the SATA PM, and any one of the multiple storage devices being connected to at least one detection pin of the multiple detection pins; The management device includes: A first determining module is configured to determine that a communication link between a first storage device and the SATA controller is disconnected, wherein the first storage device is any storage device among the multiple storage devices; a second determining module, configured to determine an in-place status of the first storage device, where the in-place status of the first storage device is used to indicate whether the first storage device is physically disconnected from the SATA PM, and the in-place status of the first storage device is detected by a detection pin connected to the first storage device; The management module is configured to determine that the first storage device is unplugged in response to determining that the in-place status of the first storage device indicates that the first storage device is physically disconnected from the SATA PM.
9. A computer device, characterized in that: The computer device includes: a processor and a memory, wherein the memory stores at least one program instruction or code, and the at least one program instruction or code is loaded and executed by the processor so that the computer device implements the storage device management method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The computer storage medium stores at least one instruction, and the at least one instruction is loaded and executed by a processor, so that the computer implements the storage device management method according to any one of claims 1 to 7.
11. A computer program product, characterized in that The computer program product includes: computer program code, which is loaded and executed by a computer to enable the computer to implement the storage device management method according to any one of claims 1 to 7.