Storage device, data storage method, and storage system
A storage device is provided. The storage device includes a control unit, a hot spare area, and a data area. Because a quantity of bits that can be stored in a second-level storage unit corresponding to the hot spare area is less than a quantity of bits that can be stored in a first-level storage unit corresponding to the data area, data read/write performance of the hot spare area is higher than data read/write performance of the data area. In a data access process, the storage device temporarily stores target data in the hot spare area, and a data read/write speed of the storage device is consistent with a data read/write speed of the hot spare area. This improves data access efficiency of the storage device.
1 . A device, comprising:
a controller;
a hot spare area; and
a data area,
wherein a storage function of the data area is provided by a first storage unit set comprised in the device, and the first storage unit set comprises a plurality of first-level storage units,
wherein a storage function of the hot spare area is provided by a plurality of second-level storage units comprised in the device, and a storage capacity of each of the first-level storage units that provides the storage function of the data area is greater than a storage capacity of each of the plurality of second-level storage units that provides the storage function of the hot spare area;
wherein the device further comprises a second storage unit set, the second storage unit set comprises a second plurality of first-level storage units providing the storage function of the hot spare area, the second plurality of first-level storage units is separate from the plurality of first-level storage units, and the plurality of second-level storage units is configured to be obtained by converting the second plurality of first-level storage units comprised in the second storage unit set such that a storage capacity of each of the second plurality of first-level storage units is greater than the storage capacity of each of the plurality of second-level storage units;
wherein the hot spare area always exists in the device after the converting to provide a cache of the device to temporarily store target data; and
wherein the controller is configured to write, under a first condition, the target data stored in the hot spare area into the data area.
2 . The device according to claim 1 , wherein
each of the first-level storage units is a multi-level cell (MLC), a triple-level cell (TLC), or a quad-level cell (QLC), and each of the plurality of second-level storage units is a single level cell (SLC);
each of the first-level storage units is a TLC or a QLC, and each of the plurality of second-level storage units is an SLC or an MLC; or
each of the first-level storage units is a QLC, and each of the plurality of second-level storage units is an SLC, an MLC, or a TLC.
3 . The device according to claim 1 , wherein in a running process of the device, the controller is configured to convert the second plurality of first-level storage units comprised in the second storage unit set into the plurality of second-level storage units.
4 . The device according to claim 3 , wherein
the controller is configured to when storage space of the hot spare area is insufficient to store the target data, convert the second plurality of first-level storage units comprised in the second storage unit set into the plurality of second-level storage units.
5 . The device according to claim 1 , wherein
when a hard disk in the device is faulty, the controller is configured to convert the plurality of second-level storage units into the plurality of first-level storage units, wherein the plurality of first-level storage units obtained through conversion is used to restore data stored in the hard disk.
6 . A method, performed by a storage device, and the method comprises:
providing, by a first storage unit set comprised in the storage device, a data area, wherein the first storage unit set comprises a plurality of first-level storage units;
providing, by a plurality of second-level storage units comprised in the storage device, a hot spare area, wherein a storage capacity of each of the plurality of first-level storage units that provides the data area is greater than a storage capacity of each of the plurality of second-level storage units that provides the hot spare area;
temporarily storing, by the hot spare area providing a cache of the storage device, target data,
wherein the storage device further comprises a second storage unit set, the second storage unit set comprises a second plurality of first-level storage units providing a storage function of the hot spare area, the second plurality of first-level storage units is separate from the plurality of first-level storage units, and the plurality of second-level storage units is configured to be obtained by converting the second plurality of first-level storage units comprised in the second storage unit set such that a storage capacity of each of the second plurality of first-level storage units is greater than the storage capacity of each of the plurality of second-level storage units;
wherein the hot spare area always exists in the storage device after the converting to provide the cache of the storage device; and
writing, by a controller comprised in the storage device, the target data stored in the hot spare area into the data area under a first condition.
7 . The method according to claim 6 , wherein each of the first-level storage units is a multi-level cell (MLC), a triple-level cell (TLC), or a quad-level cell (QLC), and each of the plurality of second-level storage units is a single level cell (SLC);
each of the first-level storage units is a TLC or a QLC, and each of the plurality of second-level storage units is an SLC or an MLC; or each of the first-level storage units is a QLC, and each of the plurality of second-level storage units is an SLC, an MLC, or a TLC.
8 . The method according to claim 6 , wherein the method further comprises:
in a running process of the storage device, converting, by the controller, the second plurality of first-level storage units comprised in the second storage unit set into the plurality of second-level storage units.
9 . The method according to claim 8 , wherein converting, by the controller, the second plurality of first-level storage units comprised in the second storage unit set into the plurality of second-level storage units comprises:
when storage space of the hot spare area is insufficient to store the target data, converting, by the controller, the second plurality of first-level storage units comprised in the second storage unit set into the plurality of second-level storage units.
10 . The method according to claim 6 , wherein the method further comprises:
when a hard disk in the storage device is faulty, converting, by the controller, the plurality of second-level storage units into plurality of the first-level storage units, wherein the plurality of first-level storage units obtained through conversion is used to restore data stored in the hard disk.
11 . A system, comprising:
a controller configured to obtain target data, and send the target data to a storage device; and
the storage device, wherein the storage device is configured to temporarily store the target data in a hot spare area comprised in the storage device, and a controller of the storage device is configured to write, under a first condition, the target data from the hot spare area into a data area comprised in the storage device,
wherein a storage function of the data area is provided by a first storage unit set comprised in the storage device, and the first storage unit set comprises a plurality of first-level storage units,
wherein a storage function of the hot spare area is provided by a plurality of second-level storage units comprised in the storage device, and a storage capacity of each of the first-level storage units that provides the storage function of the data area is greater than a storage capacity of each of the plurality of second-level storage units that provides the storage function of the hot spare area,
wherein the storage device further comprises a second storage unit set, the second storage unit set comprises a second plurality of first-level storage units providing the storage function of the hot spare area, the second plurality of first-level storage units is separate from the plurality of first-level storage units, and the plurality of second-level storage units is configured to be obtained by converting the second plurality of first-level storage units comprised in the second storage unit set such that a storage capacity of each of the second plurality of first-level storage units is greater than the storage capacity of each of the plurality of second-level storage units, and
wherein the hot spare area always exists in the storage device after the converting to provide a cache of the storage device to temporarily store target data.
12 . The storage device according to claim 11 , wherein
each of the first-level storage units is a multi-level cell (MLC), a triple-level cell (TLC), or a quad-level cell (QLC), and each of the plurality of second-level storage units is a single level cell (SLC);
each of the first-level storage units is a TLC or a QLC, and each of the plurality of second-level storage units is an SLC or an MLC; or
each of the first-level storage units is a QLC, and each of the plurality of second-level storage units is an SLC, an MLC, or a TLC.
13 . The storage device according to claim 11 , wherein
in a running process of the storage device, the controller of the storage device is configured to convert the second plurality of first-level storage units comprised in the second storage unit set into the plurality of second-level storage units.
14 . The storage device according to claim 13 , wherein
the controller of the storage device is configured to: when storage space of the hot spare area is insufficient to store the target data, convert the second plurality of first-level storage units comprised in the second storage unit set into the plurality of second-level storage units.
15 . The storage device according to claim 11 , wherein
when a hard disk in the storage device is faulty, the controller of the storage device is configured to convert the plurality of second-level storage units into the plurality of first-level storage units, wherein the plurality of first-level storage units obtained through conversion is used to restore data stored in the hard disk.