BACKGROUND
Multimedia data are increasingly present in modern life and are mostly stored in storage devices such as magnetic storage units, non-volatile memories, optical discs etc. Multimedia data usually contain audio data, video data, and digital data. When multimedia data are stored in a magnetic storage unit, e.g. a hard disk drive, two kinds of data will be stored in the hard disk drive. The first kind of data is audio/video (AV) data. Typically, the size of AV data can be hundreds of megabytes or even gigabytes. The read or write process of the AV data is an asynchronous streaming operation, and high real-time I/O is usually required. Moreover, the AV data are accessed during playback and recording processes. The second kind of data is information data. The information data contain structural information for the recordings. Typically, the size range of information is in few kilobytes. The information data are accessed before or after the playback and recording processes.
FIG. 1 shows a data storage system 110 coupled to a memory device 120. The data storage system 110 comprises a file system 115 operative to read and write data from/to the memory device 120. A hard disk drive is a common data storage system and the memory device coupled thereto is usually formatted into a plurality of clusters, which are the minimum storage units of the hard disk drive. When data having a size larger than a cluster wants to be stored in a hard disk drive formatted into a plurality of clusters, the data will be stored into more than one cluster in order to fit the size limitation of single one cluster. In this case, the AV data are typically divided into several pieces, i.e. several AV file segments, after being saved in a hard disk drive. Please refer to FIG. 2. FIG. 2 shows a linear hard disk space of a hard disk drive. The linear hard disk space 200 comprises a plurality of N clusters with cluster numbers 1, 2, . . . , k, k+1, . . . , N. Some clusters are empty clusters 110 and others which are marked with “X” are occupied cluster 212. The AV data are stored in the linear hard disk space 200 and are therefore divided into several AV file segments to fit the cluster size. The occupied clusters 212 are those clusters occupied by the AV file segments. Ideally, the AV file segments are preferably to be arranged in a continuous series. In some cases, when a hard disk drive is newly formatted, the AV data will be stored in the hard disk drive in a continuous series. As a result, no extra seeking operations will be required while the AV data are being accessed. Unfortunately, after the hard disk drive has been accessed through some AV file accessing operations such as truncation, deletion, partly erasing, the occupied clusters 212 will be dispersed randomly, as shown in FIG. 3. In this case, extra seeking operations are required while the AV data are being accessed. The arrows represent an exemplary example to illustrate the seeking operations. More seeking operations are required, when the occupied clusters 212 are more randomly distributed after the frequently file accessing operations. As a result, accessing the AV data takes more effort and results to spend more I/O accessing time. Issues of degraded I/O performance and less concurrent playback/recording streams available in system are thereby also introduced.
A hard disk drive can be divided into two or more than two storage segments (i.e. partitions), which have different cluster sizes. Please refer to FIG. 4. FIG. 4 shows a linear hard disk space 400 comprising two partitions 410 and 420. These two partitions 410 and 420 have clusters 412 and 422 respectively. The two partitions 410 and 420 are two independent storing areas, having N clusters and P clusters respectively. The size of the cluster 412 is smaller than the size of the cluster 422. Since the size of information data is usually small, a cluster with small size is more suitable for storing the information data than a cluster with large size. Please refer to FIG. 5 for a detailed explanation. In FIG. 5, two information data with the same size are stored in the partition 410 and the partition 420 respectively, and therefore utilize a cluster 412 and a cluster 422. The horizontal-lined areas 413 and 423 are actual spaces the information data occupy. The remaining parts of the utilized clusters 412 and 422 are dotted areas 414 and 424 respectively, which are empty. The dotted areas 414 and 424 are actually occupied by nothing but cannot be utilized to store data, as a cluster is the minimum unit of a partition. Consequently, the dotted areas 414 and 424 are wasted spaces. When comparing the utilized cluster 412 with the utilized cluster 422, the dotted area 424 is larger than the dotted area 414, meaning that the utilized cluster 422 has a larger wasted space than the utilized cluster 412. In short, to avoid wasted spaces, a cluster having a small size is more suitable for storing the information data than a cluster having a large size.
On the other hand, since AV data is usually large in size, a cluster having a large size is more suitable for storing the AV data than a cluster having a small size. The AV data will be divided into more pieces when being stored in a partition with a small cluster than when being stored in a partition with a large cluster. Based on the reason that a more small-piece fragmented data consumes more I/O performance when being accessed, a large cluster is recommended for storing large-sized data. Otherwise, after the hard disk drive has been accessed through some AV file operations such as truncation, deletion, partly erasing, as mentioned above, the data fragments will be seriously dispersed in such a disorder condition that the data accessing process causes more delay time. If a great deal of disk seeking operations are interleaved with continuous data transferring operations, the system buffer may overflow during recording or underflow during playback.
In summary, if a storage device is not well organized and accessed following a certain rule, some issues may occur in consequence. For example, if all the information data are mixed with AV data in the same partition, the time for gathering all the information data depends on how these data (i.e. information data and AV data) are fragmented. As a result, an ideal system boot up time cannot be guaranteed. Moreover, a de-fragmentation process must be carried out after recording creations and deletions; otherwise the data will be heavily fragmented, leading to enormous time consumption and a fragile system.
SUMMARY
One objective of the claimed embodiments is therefore to provide a storage device and a method of accessing the storage device to solve the above problem.
According to an embodiment, a storage device for storing a plurality of first data and a plurality of second data is disclosed. Each first data correlates respectively to a second data. The storage device includes a first storage segment and a second storage segment. The first storage segment is divided into a plurality of first storage units for storing the first data. The second storage segment is divided into a plurality of second storage units for storing the second data. The size of each first storage unit is larger than the size of each second storage unit, and the size of each first data is larger than the size of its correlating second data.
According to another embodiment, a method for accessing a plurality of first data and a plurality of second data in a storage device is disclosed. The storage device comprises a first storage segment and a second storage segment. The first storage segment is divided into a plurality of first storage units and the second storage segment is divided into a plurality of second storage units. Each first data correlates respectively to a second data. The method includes storing the first data in the first storage segment, and storing the second data in the second storage segment. The size of each first storage unit is larger than the size of each second storage unit, and the size of each first data is larger than the size of its correlating second data.
These and other objectives of the present embodiment will no doubt become obvious to those of ordinary skill in the art after reading the following detailed description of the preferred embodiment that is illustrated in the various figures and drawings.
BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 shows a data storage system coupled to a memory device.
FIG. 2 shows a linear hard disk space of a hard disk drive.
FIG. 3 shows the linear hard disk space of FIG. 2 after the hard disk drive has been through several AV file operations.
FIG. 4 shows a linear hard disk space comprising two partitions.
FIG. 5 shows two information data with the same size stored in the two partitions of FIG. 4 respectively.
FIG. 6 shows a linear hard disk space comprising two partitions.
FIG. 7 illustrates a flow chart of a reading process of the storage device.
FIG. 8 illustrates a flow chart of a recording process of the storage device.
FIG. 9 shows a flow chart illustrating the process of initializing a storage device.
DETAILED DESCRIPTION
The method disclosed in the present embodiment teaches a feasible arrangement of a storage device for improving the performance of the storage device. The method can be utilized with a hard disk drive or a non-volatile memory such as a flash memory. A hard disk drive is taken as an example for illustrating the method. Please refer to FIG. 6. FIG. 6 shows a linear hard disk space 600 comprising two partitions 610 and 620. The file system of the partition 610 might be different from, or the same as the file system of the partition 620. The two partitions 610 and 620 are two independent storage areas, and the size of the cluster 612 is smaller than the size of the cluster 622. The partition 610 having a small size cluster 612 is utilized for storing the small size data, e.g. the information data. The partition 620 having a large size cluster 622 is utilized for storing the large size data, e.g. the multimedia data. The multimedia data includes audio data, video data, audio/video (AV) data, and digital data. Each information data correlates to multimedia data; therefore, a file map, which correlates the information data with the multimedia data, is also stored in the partition 610. The file map is usually small in size. By arranging the storage device and data in this way, the process of accessing data in the storage device obtains some advantages. At first, the small size information data are restricted to be stored in the partition 610 having a small size cluster 612, waste of hard disk space can be avoided. Secondly, the multimedia data can avoid being seriously fragmented because the large size multimedia data are restricted to being stored in the partition 620 having a large size cluster 622. Therefore, a reduction of the number of seeking operations can be expected. Under the condition that the hard disk performance is the same, reducing seeking processes during playback or recording stream implies that the system, which controls the hard disk drive, is capable of dealing with more concurrent playback or recording streams. Thirdly, due to less seeking processes resulting from less fragmented multimedia data, the system buffer will not encounter over-consuming during the playback process or over-producing during the recording process. During the playback or recording process when data are required to be temporarily stored in the buffer or flushed from the buffer, more data can be stored or flushed because the multimedia data are stored in large clusters. Fourthly, the time consumption due to content checking or recovering will be reduced because fewer clusters are used when the multimedia data are stored in a partition with larger clusters. Fifthly, because the smaller clusters that are utilized to store the information data form a relatively small partition, the time required to gather all the information data is limited and a controllable system boot up time is guaranteed.
The multimedia data includes at least a multimedia file segment. During the process of reading the multimedia data, a sequence or an accessing order must be followed to complete the reading process. The above-mentioned file map also includes the information regarding the sequence or the accessing order. When the multimedia data is being accessed, i.e. when the multimedia data is being read or recorded, the next multimedia file segment to be accessed is determined by directly referring to the file map. As the multimedia data is less fragmented when being stored in the partition 620 having a large cluster 622, the file map becomes smaller in size. As a result, the file map is easy to be cached in a memory such as a DRAM or an SRAM during the accessing process, and therefore no synchronous data storage system access operations are required during the playback or recording process.
Please refer to FIG. 7. FIG. 7 illustrates a flow chart of a reading process of the storage device. After the reading process starts (S710), the system queries the information data and the multimedia data related to a specific title (S720). The system reads the information data of the specific title in the partition, in which the information data are stored (S730). Then, the system opens all multimedia data of the specific title in the partition, in which the multimedia data are stored, and also caches the file map in a memory (S740). The system keeps playing the specific title (S750) until a reading process is interrupted (S760) or the end of the specific title is encountered (S770). When either the reading process is interrupted or the end of the specific title is encountered, the system closes all the multimedia data (S780) and the information data (S790) and then ends the reading process (S795).
Please refer to FIG. 8. FIG. 8 illustrates a flow chart of a recording process of the storage device. After the recording process starts (S810), the system creates the information data in the partition 510 (S820). Then, the system creates multimedia data for maximum title length in the partition 520 and caches the file map in a memory (S830). The system keeps recording pre-allocated multimedia data in the partition 520 (S840) until the maximum length is reached (S850) or the recording process is interrupted (S850). When either the maximum length is reached or the recording process is interrupted, the system updates the information data in the partition 510 (S870), and truncates or deletes unused multimedia data (S880). The system establishes the relationship between the information data and the multimedia data for the recorded title in the file map (S890), and then ends the recording process (S895).
Please refer to FIG. 9. FIG. 9 shows a flow chart illustrating the process of initializing a storage device. As soon as the initialization starts (S910), the total size of the partition 510 is initially determined (S920). The total size of the partition 510 is equal to the number of allowed titles multiplied by the predefined information size for one title. If the counted size of the partition 510 turns out to be larger than the size of the hard disk space 500 (S930), the initialization process is aborted (S950) and then ended (S990). If, however, the counted size of the partition 510 is not larger than the size of the hard disk space 500, the size of the partition 520 is then determined (S940). The size of the partition 520 is equal to the size of the hard disk space 500 minus the size of the partition 510. The storage device is then divided into two partitions according to respective sizes (S960). The two partitions are formatted according to respective pre-defined cluster sizes (S970). Finally, the file map is created in the information data partition, i.e. the partition 510 (S980), and the initialization process ends (S990).
In summary, according to the embodiments a method is disclosed for accessing a storage device. The storage device is divided into two segments and each segment is further divided into a plurality of storage units. The size of the storage unit of one segment is different from the size of the storage unit of the other segment. The information data and the multimedia data are now separately stored into different segments. The information data, which are usually small in size, are stored into the segment whose storage unit size is smaller; the multimedia data, which are usually large in size, are stored into the segment whose storage unit size is larger. As a result, disk seeking operations can be reduced during recording or playback processes. Storage space is less wasted and de-fragmentation operations can be omitted even after many reading or writing operations. Moreover, a file map, which correlates the information data with the multimedia data, and indicates an accessing order of the multimedia file segments, is stored together with the information data. Since the file map is so small in size that it can be easily cached, synchronous data storage system read or write operations are no longer necessary during playback or recording processes.
Those skilled in the art will readily observe that numerous modifications and alterations of the device and method may be made while retaining the teachings of the embodiment. Accordingly, the above disclosure should be construed as limited only by the metes and bounds of the appended claims.