Patent Description:
Recently developed electronic devices such as a smart phone, a tablet PC, a portable multimedia player (PMP), a personal digital assistant (PDA), a laptop personal computer (laptop PC), and a wearable device are capable of not only providing mobility but also performing various functions (e.g., a game, a social network service (SNS), Internet, multimedia, and taking and executing a picture/video).

The electronic device may include a storage device such as a NAND flash memory or a solid state disk (SSD) to store high-capacity data required to perform various functions.

The electronic device can write at least some data of an application in a main memory by using a file system that is a sort of program module or software that can be executed by a processor. Also, the electronic device may classify the types of files being written using the file system at a time when application data is written on the main memory, and may control them to be separately stored in storage.

Utilizing a write pattern from a time when a file is written in a page cache to a time when it is stored in the storage, the electronic device may distinguish and store a file (hot file) in which file modification and deletion frequently occurs and a file (cold file) in which change rarely occurs after the file is stored.

The technique to distinguish and separate the hot/cold files is being handled in various ways in the field of storage and file system. The reason is that if the hot/cold files are well separated and stored, the garbage collection operation is minimized by referring to this information in the NAND storage or the file system, or fragmentation is minimized by continuously storing data blocks when storing the cold file of a relatively large size compared to the hot file, and it is possible to optimize file storing performance and NAND storage lifespan.

The existing technique to separate the hot/cold files is utilizing various methods such as the simplest method of predicting the possibility of file change based on the file name extension (. mp4, etc.), a method of predicting based on directory characteristics designated for each OS, and a method of predicting through a block write size.

<CIT> discloses techniques for storing data in a plurality of storage tiers on a computing node. A node receives a request to write data corresponding to at least a first portion of a file and determines whether to perform the request either as an in-place write or as an out-of-place write. Upon determining to perform the request as the in-place write, the node writes the data to a first location on a storage tier which currently stores the first portion of the file. Upon determining to perform the request as the out-of-place write, the node writes the data to a second location on one of the storage tiers, other than the first location.

In case of classifying the hot/cold files based on a predefined rule, it may have a limitation that it is difficult to predict the type of a file by a file name extension when a file with a file name extension used only in a certain application is generated (for example,. exo file in case of Youtube cache) or when there is no file name extension.

In addition, although a predefined directory name may be used to separate the hot/cold files, there is a limitation as in case of using the file name extension that it is difficult to predict the type of a file by the directory name when a new directory name or an ambiguous directory name is used.

According to various embodiments of the disclosure, an electronic device includes a random access memory, a storage, and a processor. The processor is configured to write a file of an application in the memory in response to a file input request of the application, to identify a write pattern of the file at a first time of writing the file of the application in the memory, followed by updating the write pattern in the memory, to classify the file as one of a hot file and a cold file based on the write pattern of the file at a second time of copying the file written in the memory to the storage, and to control storing a classification result of the file together with the file in the storage or storing the file in a first area or a second area of the storage based on the classification result of the file. The hot file is a file whose modification and/or deletion occurs frequently compared to the cold file, and the cold file is a file whose modification and/or deletion occurs infrequently compared to the hot file. The write pattern includes a degree of modification of the file. The processor is further configured to control learning the write pattern for each file by using machine learning; assign a weight to at least one feature of the write pattern for the hot file based on a learning result; an assign a weight to at least one feature of the write pattern for the cold file based on the learning result.

According to various embodiments of the disclosure, a file system operating method of an electronic device includes writing a file of an application in a memory in response to a file input request of the application, identifying a write pattern of the file at a first time of writing the file of the application in the memory, followed by updating the write pattern in the memory, classifying the file as a hot file or a cold file based on the write pattern of the file at a second time of copying the file written in the memory to a storage, and storing a classification result of the file together with the file in the storage or storing the file in a first area or a second area of the storage based on the classification result of the file. The hot file is a file whose modification and/or deletion occurs frequently compared to the cold file, and the cold file is a file whose modification and/or deletion occurs infrequently compared to the hot file. The write pattern includes a degree of modification of the file. The method comprises controlling learning the write pattern for each file by using machine learning; and assigning a weight to at least one feature of the write pattern for the hot file and the cold file based on a learning result.

According to various embodiments, the electronic device can predict a file type by utilizing a write pattern that can be identified during a file writeback, even in case that there is no or ambiguous file name extension or directory setting.

According to various embodiments, the electronic device can collect file write patterns at runtime without a file name extension or directory setting, and predict a file type by using the collected pattern information.

According to various embodiments, before requesting to store the contents of the page cache in storage, the writeback thread module of the disclosure can predict a hot file or a cold file by using the previously collected write pattern information for each file. Based on the predicted result, the electronic device can tag hint information when storing the file in the storage or store it in divided areas by the file system itself, thereby optimizing the storing performance of the storage and improving the lifespan of the storage.

According to various embodiments, the electronic device can perform learning on the numerical values of features of each write pattern in various environments (e.g., a mobile environment such as Android and a cloud server environment) and thereby increase the prediction accuracy of hot/cold files.

Referring to <FIG>, the electronic device <NUM> in the network environment <NUM> may communicate with an electronic device <NUM> via a first network <NUM> (e.g., a short-range wireless communication network), or at least one of an electronic device <NUM> or a server <NUM> via a second network <NUM> (e.g., a long-range wireless communication network). According to an embodiment, the electronic device <NUM> may include a processor <NUM>, memory <NUM>, an input module <NUM>, a sound output module <NUM>, a display module <NUM>, an audio module <NUM>, a sensor module <NUM>, an interface <NUM>, a connecting terminal <NUM>, a haptic module <NUM>, a camera module <NUM>, a power management module <NUM>, a battery <NUM>, a communication module <NUM>, a subscriber identification module(SIM) <NUM>, or an antenna module <NUM>. In some embodiments, at least one of the components (e.g., the connecting terminal <NUM>) may be omitted from the electronic device <NUM>, or one or more other components may be added in the electronic device <NUM>. In some embodiments, some of the components (e.g., the sensor module <NUM>, the camera module <NUM>, or the antenna module <NUM>) may be implemented as a single component (e.g., the display module <NUM>).

It should be appreciated that various embodiments of the present disclosure and the terms used therein are not intended to limit the technological features set forth herein to particular embodiments. The invention is defined by the scope of the claims.

<FIG> illustrates a file classification operation of an electronic device according to a comparative embodiment.

The electronic device according to the comparative embodiment may include a processor (e.g., the processor <NUM> in <FIG>), a memory <NUM>, and a storage <NUM>. The processor <NUM> may classify and store files in the memory <NUM> in response to a file write request of at least one application. In this case, the processor <NUM> may classify the file as either a hot file or a cold file according to a predefined rule <NUM> on a file system <NUM> in the memory <NUM>. The hot file may refer to a file whose modification and/or deletion occurs relatively frequently compared to the cold file. The cold file may refer to a file whose modification and/or deletion occurs relatively infrequently compared to the hot file. The hot file may include, for example, DB and xml files, and the cold file may include, for example, media files such as photos and videos. The predefined rule <NUM> may include, for example, at least one of a method for predicting the possibility of a file change based on a file name extension (. mp4, etc.), a method for predicting it based on directory characteristics specified for each specific OS, or a method for predicting it through a block write size or the like.

The memory <NUM> may include the file system <NUM> that is a sort of program module (e.g., the program module <NUM> in <FIG>) that can be executed by the processor <NUM>. Using the file system <NUM>, the electronic device may separately store a plurality of files in the storage <NUM>.

Using a writeback thread <NUM>, the processor <NUM> may check file classification information and whether file data in the memory <NUM> is identical with file data stored in the storage <NUM>. If the file data in the memory <NUM> is not identical with the file data stored in the storage <NUM>, the processor <NUM> may control writeback to be performed.

The writeback may refer to an operation of updating only the cache of the memory <NUM>, not the storage <NUM>, when writing data of a file. That is, when writing the data of the file, the processor <NUM> may not write it in the storage <NUM> while updating only the cache and, only when necessary, may control the writing in a main memory device including the storage <NUM> or in an auxiliary memory device.

However, because the electronic device according to the comparative embodiment classifies files using the predefined rule <NUM>, it may have a limitation that it is difficult to predict the type of a file by the file name extension in case that a file with a file name extension used only in a certain application is generated (for example,. exo file in case of Youtube cache) or there is no file name extension. Also, the electronic device according to the comparative embodiment may classify files based on predefined directory names, but it may be difficult to predict the type of a file based on the directory name, similarly to the case of using the file name extension.

Hereinafter, an electronic device and a file system operating method thereof for overcoming the above-mentioned limitation will be described.

<FIG> illustrates a file classification operation of an electronic device according to various embodiments.

The electronic device shown in <FIG> (e.g., the electronic device <NUM> in <FIG>) may include a processor (e.g., the processor <NUM> in <FIG>), a memory <NUM>, and a storage <NUM>. In this case, the memory <NUM> may include the volatile memory <NUM> in <FIG>, and the storage <NUM> may include the non-volatile memory <NUM> in <FIG>. The processor <NUM> may write a file in the memory <NUM> in response to a file write request of at least one application. In this case, the electronic device <NUM> in <FIG> may classify the file by using a write pattern of application file instead of a predefined rule (e.g., <NUM> in <FIG>).

The electronic device <NUM> according to various embodiments of the disclosure is capable of distinguishing and storing a hot file that is frequently modified and deleted and a cold file that rarely changes after stored, by utilizing a write pattern of at least a part of a time period between a time a file is written to the page cache on the memory <NUM> and a time it is stored in the storage <NUM>.

According to an embodiment, the memory <NUM> may include a file system <NUM> that is a sort of program module (e.g., the program module <NUM> in <FIG>) that can be executed by the processor <NUM>. Using the file system <NUM>, the electronic device may classify the types of files and separately store them in the storage <NUM>.

According to an embodiment, the storage <NUM> may include a first area <NUM> for storing the hot file. Also, the storage <NUM> may include a second area <NUM> for storing the cold file. The electronic device <NUM> may store the hot file frequently modified and deleted in the first area <NUM>, and store the cold file rarely changing after stored in the second area <NUM>.

The electronic device <NUM> according to various embodiments of the disclosure may update only information related to a write pattern of a file at the time of storing the file in the memory <NUM>. Thereafter, the electronic device <NUM> may calculate a probability so that the type of the file can be distinguished using the writeback thread <NUM> at the time of sending data of the file down to the storage <NUM>. The electronic device <NUM> may prevent a response delay due to the probability calculation by adjusting the timing of the probability calculation.

According to an embodiment, the file system <NUM> may include a write pattern monitor module <NUM> and a writeback thread module <NUM>. The write pattern monitor module <NUM> may detect an application's request for writing a file in the file system <NUM>, and monitor main characteristics (hereinafter, referred to as 'write pattern' or 'first pattern') of a write operation. The write pattern monitor module <NUM> may temporarily store the monitored write pattern of a file in a file object (not shown) in the memory <NUM>.

According to an embodiment, a feature of a write pattern of a file may include at least one of an overwrite count, an append count, a write chunk, and a system call count (fsync). Hereinafter, such features of a write pattern and a file classification method will be described.

<FIG> is a block diagram illustrating components of an electronic device according to various embodiments.

With reference to <FIG>, the electronic device <NUM> may include a processor <NUM>, a memory <NUM>, and a storage <NUM>, and some of the illustrated components may be omitted or replaced. The electronic device <NUM> may further include at least some of the components and/or functions of the electronic device <NUM> shown in <FIG>. At least some of the respective components of the illustrated (or not illustrated) electronic device may be operatively, functionally, and/or electrically connected.

According to various embodiments, the processor <NUM> is a component capable of performing an operation or data processing related to control and/or communication of respective components of the electronic device <NUM>, and may be composed of one or more processors. The processor <NUM> may include at least some of the configuration and/or functions of the processor <NUM> shown in <FIG>.

According to various embodiments, there will be no limitations on the operation and data processing functions that the processor <NUM> can implement in the electronic device <NUM>, but hereinafter features related to the control of the file system <NUM> in the memory <NUM> will be described in detail. The operations of the processor <NUM> may be performed by loading instructions stored in the memory <NUM> (e.g., the memory <NUM> in <FIG>). The file system <NUM> may refer to a system for storing or organizing files or data to be easily found or accessed in the electronic device <NUM>. The file system <NUM> according to various embodiments of the disclosure may control storing and managing files and directories in the storage <NUM> and the memory <NUM>.

According to various embodiments, the electronic device <NUM> may include at least one memory <NUM> and a storage <NUM>. In this case, the memory <NUM> may include the volatile memory <NUM> in <FIG>, and the storage <NUM> may include the non-volatile memory <NUM> in <FIG>. The memory <NUM> may include a volatile memory such as dynamic random access memory (DRAM), static RAM (SRAM), or synchronous dynamic RAM (SDRAM). The storage <NUM> may include at least one of one-time programmable ROM (OTPROM), PROM, EPROM, EEPROM, mask ROM, flash ROM, flash memory, hard drive, or solid state drive (SSD). Alternatively, the memory <NUM> may include a large-capacity storage device as a non-volatile memory and. For example, the memory <NUM> may include at least one of one-time programmable ROM (OTPROM), PROM, EPROM, EEPROM, mask ROM, flash ROM, flash memory, hard drive, or solid state drive (SSD). The memory <NUM> may store various file data, and the stored file data may be updated according to the operation of the processor <NUM>.

According to various embodiments, the file system <NUM> may refer to a system that is usable by intercepting a system call at a kernel level without a separate daemon. The daemon may mean a background process that is executed when the system is first started. The file system <NUM> may wait for a user's request in a state where the daemon is stored in the memory <NUM>, and upon occurrence of the user's request, recognize the user's request.

According to various embodiments, the file system <NUM> may provide a file in response to a request of an application layer. The file system <NUM> may be located on a kernel layer. The operation of providing the file may refer to an operation of opening and reading a requested file or reading an already opened file and delivering it to the application layer. The operation of opening the file may refer to an operation of finding a file name in a storage device and preparing for reading and/or writing in the application layer. The operation of reading the file may refer to an operation of loading data of an opened file into the memory <NUM>. Loading may refer to an operation of calling a program itself and resources required for an operation from an auxiliary storage device (e.g., a hard disk) into a main storage device (e.g., a memory).

According to an embodiment, in response to the request of the application layer, the file system <NUM> may read the requested file and provide it to the application layer if the requested file exists in the upper file system in the memory <NUM>, or read the file in the storage <NUM> and provide it to the application layer if the requested file does not exist in the upper file system.

According to various embodiments, the processor <NUM> may execute a variety of software (e.g., the program <NUM>). The memory <NUM> may include the file system <NUM>. The file system <NUM> is a program module stored in the memory <NUM> and may be operated by the processor <NUM>.

According to various embodiments, the processor <NUM> may store data in the form of a file in the storage <NUM> through the file system <NUM>. The file system <NUM> may refer to a data structure or system managed by the processor <NUM> to store data in the storage <NUM>. The electronic device <NUM> may utilize the file system <NUM> to write data in the storage <NUM> or to efficiently read data stored in the storage <NUM>. In various embodiments, the file system <NUM> is described on the assumption that it is implemented as a flash friendly file system (F2FS), but the form of the file system <NUM> is not limited to the F2FS and any other form of file system may be included. The F2FS may refer to a file system optimized for NAND flash memory based on log-based storage. The F2FS will be described with reference to <FIG> and <FIG>.

According to various embodiments, the storage <NUM> may include a first area <NUM> for storing a first file or hot file. Also, the storage <NUM> may include a second area <NUM> for storing a second file or cold file.

The first file or hot file may refer to a file whose modification and/or deletion occurs relatively frequently compared to the cold file. The second file or cold file may refer to a file whose modification and/or deletion does not occur relatively frequently compared to the hot file.

According to various embodiments, the file system <NUM> may include a write pattern monitor module (e.g., the write pattern monitor module <NUM> in <FIG>) and a writeback thread module (e.g., the writeback thread module <NUM> in <FIG>). The write pattern monitor module <NUM> may detect an application's request for writing a file in the file system <NUM>, and monitor main characteristics (hereinafter, referred to as 'write pattern' or 'first pattern') of a write operation. The write pattern monitor module <NUM> may temporarily store the monitored pattern of a file in a file object (not shown) in the memory <NUM>.

According to an embodiment, a feature of a write pattern of a file may include at least one of an overwrite count, an append count, a write chunk, and a system call count (fsync).

The overwrite count may refer to the number of times to modify a part of a file in the middle. For example, in case that some cells are modified in an Excel file, the processor <NUM> may classify the file as the overwrite count when saving the file. If the overwrite count of the file is relatively large, the processor <NUM> may determine that the modifications of the file is frequent, and thereby classify the file as close to a hot file.

The append count may refer to the number of times to newly append other data to an existing file. For example, in case that new data is added in a jpg file beyond a partial modification level of the file, the processor <NUM> may classify the file as the append count when saving the file. If the append count of the file is relatively large, the processor <NUM> may determine that new content is often added to the file, and thereby classify the file as close to a cold file.

The write chunk may refer to a size unit of a file stored in an operation of writing the file in the memory <NUM>. For example, in case that the write chunk is relatively small, the processor <NUM> may determine that a small amount of write is performed during one write operation, and classify it as close to a hot file. Conversely, in case that the write chunk is relatively large, the processor <NUM> may determine that a large amount of write is performed during one write operation, and classify it as close to a cold file.

The system call count (fsync) may refer to the number of times that a file recorded in the memory <NUM> is sent down or written to the storage <NUM>. For example, in case that the fsync is relatively low, the processor <NUM> may determine that a file recorded in the memory <NUM> is a file with a relatively small number of times being written to the storage <NUM>. That is, in case that the fsync is relatively low, the processor <NUM> may determine that the file is not frequently modified, and classify it as close to a cold file. Conversely, in case that the fsync is relatively high, the processor <NUM> may determine that the file is modified relatively frequently, and classify it as close to a hot file. If the fsync is less than a first level, the processor <NUM> may determine that the file is not frequently modified, and classify it as close to a cold file. For example, when the fsync is less than <NUM>, the processor <NUM> may determine that the file is not frequently modified, and classify it as close to a cold file. In this case, the numerical value or the first level of the fsync may not be limited to the above, and may be determined by a developer's setting up or through machine learning that learns a plurality of files.

According to an embodiment, the processor <NUM> may classify a specific file as a hot file or a cold file, based on the above-mentioned at least one feature of the write pattern. However, even if referring to the features of the write pattern when classifying a specific file as a hot file or a cold file, the criteria for classifying the file type based on what numerical value may be ambiguous. For example, in case that the fsync of a specific file is relatively high, the electronic device <NUM> may determine the file as being modified relatively frequently, and classify it as close to a hot file. However, whether the numerical value of the fsync is relatively high or low may vary depending on criteria, and it may be difficult for users to determine such criteria.

According to an embodiment, the electronic device <NUM> may learn write patterns of files by using machine learning and establish a criterion for classifying the files. The electronic device <NUM> may identify a write pattern of a specific file and, based on a feature of the identified write pattern, determine a feature of a write pattern of a hot file and a feature of a write pattern of a cold file. For example, in case that a file name extension is xml (i.e., the file name extension of an Excel file), the file may be close to a hot file whose modification is relatively frequent. The electronic device <NUM> may identify a write pattern and feature of the xml file by using machine learning. The electronic device <NUM> may identify at least one of the write pattern of the xml file and information that the xml file is close to a hot file, and control an artificial intelligence model to learn the write pattern and feature of the hot file. In this case, as mentioned above, the feature may include at least one of the overwrite count, the append count, the write chunk, and the system call count (fsync).

Or, for example, in case that the file name extension is jpg (i.e., the file name extension of a photo or picture file), the file may be close to a cold file whose modification occurs infrequently. The electronic device <NUM> may identify a write pattern and feature of the jpg file by using machine learning. The electronic device <NUM> may identify at least one of the write pattern of the jpg file and information that the jpg file is close to a cold file, and control the artificial intelligence model to learn the writing pattern and feature of the cold file.

The electronic device <NUM> may perform the machine learning using various files and classify each of the various files as one of a hot file and a cold file. The machine learning may be executed in an auxiliary processor (e.g., the auxiliary processor <NUM> in <FIG>) or an NPU processor included in the processor <NUM> or executed in a main processor (e.g., the main processor <NUM> in <FIG>). The processor <NUM> (e.g., the NPU processor) may provide a service of the electronic device <NUM> according to various embodiments of the disclosure by using an artificial intelligence model. For example, the processor <NUM> (e.g., the NPU processor) may recognize a file write pattern and, based on this, determine whether a specific file is classified as a hot file or a cold file.

According to an embodiment, the storage <NUM> may include an artificial intelligence model for recognizing a file write pattern and classifying a specific file based thereon. The main processor <NUM> may control the artificial intelligence model to perform machine learning using the NPU processor. The main processor <NUM> may control the artificial intelligence model to identify the type of a file written in the memory <NUM> based on this learning. A learning process of the artificial intelligence model will be described with reference to <FIG>.

The electronic device <NUM> may identify whether a file is a hot file or a cold file, and also obtain data about a write pattern and feature of the hot file. In addition, the electronic device <NUM> may identify whether a file is a hot file or a cold file, and also obtain data about a write pattern and feature of the cold file. For example, while performing the machine learning on various files, the electronic device <NUM> may determine the distribution of the system call count (fsync) of the hot file and the distribution of the system call count (fsync) of the cold file. Based on this learning, the electronic device <NUM> may identify the system call count (fsync) for an arbitrary file and classify, based on the numerical value of the system call count (fsync), whether the arbitrary file is a hot file or a cold file.

Using such machine learning, the electronic device <NUM> may learn more and more files and establish increasingly a sophisticated classification criterion for the numerical value of the system call count (fsync).

The number of files or write pattern features that the electronic device <NUM> can learn using the machine learning is not limited to the overwrite count, the append count, the write chunk, and the system call count (fsync). Using the machine learning, the electronic device <NUM> may learn any write pattern feature other than the aforementioned overwrite count, append count, write chunk, and system call count (fsync). Such other write pattern features may include, for example, at least one of a file size, a file modification time, a modification interval, a dirty page count, an append write count, an overwrite count, a chunk size, a fsync count, a directory name, and a use specific file system. Here, the directory name may refer to the name of a folder (directory) in which a file is stored. For example, in case that a file is stored in a temporary folder (temp), the processor <NUM> may classify the file as close to a hot file.

According to an embodiment, the electronic device <NUM> may update a weight of a feature of a write pattern by using the machine learning. For example, in case of performing learning by using a hot file, the electronic device <NUM> may increase weights for the fsync count and the overwrite count. In case of performing learning by using a cold file, the electronic device <NUM> may increase weights for the write chunk, the dirty page count, and the append count. The write chunk may denote an average file size upon a file write request, and in case of a cold file, a file size modified in response to a single write request may be relatively large because the modification is not frequent. Thus, the cold file may have a relatively high write chunk, and the electronic device <NUM> may increase the weight of the write chunk for the cold file after learning through the machine learning.

According to an embodiment, the dirty page may denote a file whose contents are different between the memory <NUM> and the storage <NUM>. In case that a file is frequently modified, the contents of the file in the memory <NUM> may be different from those of the file stored in the storage <NUM>. In case of a cold file, a write operation to the storage <NUM> does not occur relatively frequently, and many writes may be performed at once. In this case, because of a low number of times of writes, the cold file may contain relatively many dirty pages compared to the hot file. So, the cold file may have relatively many dirty pages, and the electronic device <NUM> may increase the weight of the dirty page count for the cold file after learning through the machine learning.

According to an embodiment, a method of obtaining weights using the machine learning may include a method of performing regression analysis. Regression may refer to a phenomenon that a plurality of distributed values are gathered in an average or representative state. The regression analysis method may include logistic regression or multiple linear regression.

The method of obtaining the weights using the machine learning may include a method of applying a 'pre-learned regression expression' through various write patterns in advance upon applying the regression. Alternatively, the method of obtaining the weights using the machine learning may include a method of learning the electronic device <NUM> in real time.

The electronic device <NUM> may classify an arbitrary file as a hot file or a cold file, based on a fixed regression expression obtained as a result of external learning in advance by applying the pre-learned regression expression. Alternatively, the electronic device <NUM> may learn various write patterns in real time. In this case, after learning using a write pattern stored by the write pattern monitor module (e.g., the write pattern monitor module <NUM> in <FIG>), the electronic device <NUM> may update the regression expression by itself at a specific time or at a specific period.

According to an embodiment, the electronic device <NUM> may perform learning in each environment by using write patterns of files collected in different environments. For example, the electronic device <NUM> may learn a write pattern requested by an application in a mobile environment including Android. Also, the electronic device <NUM> may learn a write pattern requested by an application process in a cloud server environment. The environments in which the electronic device <NUM> can learn are not limited to the mobile environment and the cloud server environment. A difference in processing power for machine learning processing between respective environments may occur. Performing learning in each environment, the electronic device <NUM> may improve prediction accuracy upon classifying arbitrary files.

According to an embodiment, the electronic device <NUM> may update the write pattern of the file at the time of storing the file in the page cache of the memory <NUM>, and calculate a probability of how quickly the file in the storage <NUM> is erased at the time of writing the file of the memory <NUM> to the storage <NUM>. The electronic device <NUM> may determine that the faster the file in the storage <NUM> is erased, the closer to a hot file that is frequently modified. By calculating the later probability instead of calculating the probability at the time of storing the file in the memory <NUM>, it is possible to prevent a response delay when an application requests a write to the memory <NUM>.

According to an embodiment, an equation for calculating the probability of how quickly a file is erased at the time of writing the file to the storage <NUM> or the probability that a file belongs to a hot file is as shown in Equation <NUM>.

In addition, b (bias value) may be derived as a result of machine learning together with a weight. The artificial intelligence model may derive a classification result of a file, as a target of analysis, differently depending on a bias value even if the weight or w value is the same in Equation <NUM>. For example, in case that the bias is more than or equal to a certain level, the artificial intelligence model may classify the same write pattern as a hot file. Also, in case that the bias is less than a certain level, the artificial intelligence model may classify the same write pattern as a cold file. In summary, the artificial intelligence model may adjust the position of the calculated W value according to b (bias value).

Also, X may denote a feature of a write pattern of an arbitrary file. The feature of the write pattern may include, for example, at least one of a file size, a file modification time, a modification interval, a dirty page count, an append write count, an overwrite count, a chunk size, a fsync count, a directory name, and a use-specific file system. Also, b may denote bias. In case of a large bias of data, a difference between a predicted value and an actual value may be large, and as the machine learning model for calculating the probability becomes simpler, the bias of the data may increase. The processor <NUM> may control the value of the bias such that the sum of bias and variance is minimized.

<FIG> and <FIG> are diagrams illustrating a process of utilizing classified files in a garbage collection operation in an electronic device according to various embodiments.

The garbage collection operation may refer to an operation of freeing an unnecessary area in a memory area dynamically allocated by a program. The unnecessary area may denote an area in which a file containing information before modification is stored in case that information on the file is changed. Hereinafter, a file containing information before modification will be referred to as an invalid block <NUM>.

According to an embodiment, the electronic device (e.g., the electronic device <NUM> in <FIG>) may include a processor (e.g., the processor <NUM> in <FIG>), a memory <NUM>, and a storage <NUM>. The memory <NUM> may include a file system <NUM>. The file system <NUM> may refer to a system for storing or organizing files or data to be easily found or accessed in the electronic device <NUM>. The file system <NUM> according to various embodiments of the disclosure may control storing and managing files and directories in the storage <NUM> and the memory <NUM>.

According to an embodiment, the file system <NUM> may include a write pattern monitor module (e.g., the write pattern monitor module <NUM> in <FIG>) and a writeback thread module (e.g., the writeback thread module <NUM> in <FIG>). The write pattern monitor module <NUM> may detect an application's request for writing a file in the file system <NUM>, and monitor main characteristics (e.g., a write pattern) of a write operation. The write pattern monitor module <NUM> may temporarily store the monitored pattern of a file in a file object (not shown) in the memory <NUM>. The file system <NUM> may classify a file as a hot file <NUM> or a cold file <NUM>, based on the write pattern of the file. Alternatively, the file system <NUM> may classify the file as a first file or a second file, based on the write pattern of the file. The first file or hot file may refer to a file whose modification and/or deletion occurs relatively frequently. The second file or cold file may refer to a file whose modification and/or deletion does not occur relatively frequently.

The processor <NUM> may classify an arbitrary file as the hot file <NUM> or the cold file <NUM> and may separately store it in the storage <NUM>. Alternatively, the processor <NUM> may classify an arbitrary file as the hot file <NUM> or the cold file <NUM> and store it in the storage <NUM> by tagging a hint about the type of the file.

According to <FIG>, the processor <NUM> may store file information in first to fourth spaces <NUM> to <NUM> in the storage <NUM>. Here, the space in the storage <NUM> is not limited to the first space <NUM> to the fourth space <NUM>, and the number of spaces may vary according to classification.

According to a comparative embodiment shown in an upper part of <FIG>, the cold file <NUM> and the invalid block <NUM> may be stored in the first space <NUM>. The invalid block <NUM> may refer to a file containing information before modification in case that the file is modified.

According to an embodiment, a file written in the memory <NUM> may be classified as one of the hot file <NUM> and the cold file <NUM> by an artificial intelligence model. The electronic device <NUM> may identify whether a file classified using the file system <NUM> is the latest file or the invalid block <NUM> containing information before modification. The electronic device <NUM> may identify the type of the invalid block <NUM> identified based on information of the file classified when the file is written in the storage <NUM>. For example, a specific file classified as the hot file <NUM> when being written in the storage <NUM> may still be classified as the hot file <NUM> even if it is identified as the invalid block <NUM>.

According to the comparative embodiment in the upper part of <FIG>, the cold file <NUM> and the invalid block <NUM> may be stored in the first space <NUM> and the second space <NUM>. In this case, the arrangement of the cold file <NUM> and the invalid block <NUM> may be different for each space. In the third space <NUM>, a modified file among the hot files <NUM> may be stored. The fourth space <NUM> may maintain a state of a free space that does not contain any files.

According to the comparative embodiment in the upper part of <FIG>, the processor <NUM> may delete the invalid block <NUM> for space utilization, and separately store the remaining files in other spaces depending on the file type (e.g., the hot file <NUM> or the cold file <NUM>). The processor <NUM> may control deleting the invalid blocks <NUM> from the first space <NUM> and the second space <NUM>, copying the remaining cold files <NUM> to the fourth space <NUM>, and deleting the cold files <NUM> from the first space <NUM> and the second space <NUM>. In this case, the first space <NUM> and the second space <NUM> may be secured as free spaces. However, in this process, the storage <NUM> performs a command to delete the invalid blocks <NUM>, a command to copy and move the remaining cold files <NUM>, and a command to delete the cold files <NUM> from the first space <NUM> and the second space <NUM>, thereby causing the amount of disk write to be increased. In the storage <NUM>, when the amount of disk write increases, storage performance and lifespan may decrease.

The electronic device <NUM> according to various embodiments of the disclosure may efficiently secure the free space without increasing the amount of disk write during such a file organizing process.

According to an embodiment shown in a lower part of <FIG>, the processor <NUM> may classify a file as the hot file <NUM> or the cold file <NUM> by using a probability calculation when writing the file in the storage <NUM>. Also, the processor <NUM> may control a plurality of files to be stored in different spaces, based on the types of the classified files. For example, the processor <NUM> may control the hot files <NUM> to be stored in the first space <NUM> and the third space <NUM> and the cold files <NUM> to be stored in the second space <NUM>. The areas in which the hot files <NUM> and the cold files <NUM> are stored are not limited thereto, and may vary depending on at least one of a user's classification, the number of hot files <NUM> or the number of cold files <NUM>.

The processor <NUM> may identify that a file is modified and thereby becomes the invalid block <NUM>, and may control the invalid block <NUM> to be deleted. In this case, in the storage <NUM>, the invalid block <NUM> may be deleted from the first space <NUM>, and the remaining second space <NUM> to the fourth space <NUM> that do not include the invalid block <NUM> may not ask for a separate command. In the previous comparative embodiment, the storage <NUM> may have to perform a command to delete the invalid blocks <NUM>, a command to copy and move the remaining cold files <NUM>, and a command to delete the cold files <NUM> from the first space <NUM> and the second space <NUM> in the file organizing process. On the other hand, in the embodiment using the electronic device according to the disclosure, the storage <NUM> only needs to perform a command to delete the invalid blocks <NUM>, so it is possible to efficiently secure a free space without increasing the amount of disk write.

<FIG> is a flowchart illustrating a method of operating a file system of an electronic device according to various embodiments.

The operations described with reference to <FIG> may be implemented based on instructions that may be stored in a computer-readable recording medium or a memory (<NUM> in <FIG>).

The illustrated method <NUM> may be executed by the electronic device (e.g., the electronic device <NUM> in <FIG>) described above with reference to <FIG>, and the above-described technical features will be omitted below.

A processor (e.g., the processor <NUM> in <FIG>) may load a file system (e.g., the file system <NUM> in <FIG>) at operation <NUM>. Then, at operation <NUM>, the processor <NUM> may receive, from an application (e.g., the application <NUM> in <FIG>), an input or output request for an application-related file. The processor <NUM> may simultaneously receive input or output requests from a plurality of applications.

At operation <NUM>, the processor <NUM> may identify whether or not the input or output request received from the application <NUM> is a write request or a sync request. The write request may refer to a request for storing a file of the application <NUM> in a memory (e.g., the memory <NUM> in <FIG>). The sync request may refer to a request for updating or modifying a file in a storage (e.g., the storage <NUM> in <FIG>) to match the file stored in the memory <NUM>.

At operation <NUM>, in response to identifying that the input or output request received from the application <NUM> is a write request or a sync request, the processor <NUM> may extract information related to a write pattern of a file and control it to be stored in a file object. The information related to the write pattern of the file may include a feature of the write pattern of the file. According to an embodiment, the feature of the write pattern of the file may include at least one of an overwrite count, an append count, a write chunk, and a system call count (fsync). In addition, the feature of the write pattern of the file may include, for example, at least one of a file size, a file modification time, a modification interval, a dirty page count, an append write count, an overwrite count, a chunk size, a fsync count, a directory name, and a use specific file system. This has been previously described in <FIG>.

The file system operating method of the electronic device <NUM> according to various embodiments of the disclosure may update only information related to the write pattern of the file at the time of storing the file in the memory <NUM>. Thereafter, at the time of sending data of the file down to the storage <NUM>, the electronic device <NUM> may calculate a probability so that the type of the file can be distinguished using a writeback thread (e.g., the writeback thread <NUM> in <FIG>). The electronic device <NUM> may prevent a response delay due to the probability calculation by adjusting the timing of the probability calculation. Here, the type of the file may include, for example, a hot file (e.g., the hot file <NUM> in <FIG>) or a cold file (e.g., the cold file <NUM> in <FIG>). The hot file <NUM> may refer to a file whose modification and/or deletion occurs relatively frequently. The cold file <NUM> may refer to a file whose modification and/or deletion occurs relatively infrequently.

Thereafter, at operation <NUM>, the processor <NUM> may perform the input or output of a file in response to the file input or output request. In case that at the operation <NUM> the input or output request received from the application <NUM> is neither a write request nor a sync request, the processor <NUM> may perform the input or output of the file without separately extracting information related to the write pattern of the file.

At operation <NUM>, the processor <NUM> may determine whether writeback processing is needed in the input or output of the file. The writeback may refer to an operation of updating only the cache of the memory <NUM>, not the storage <NUM>, when writing data of a file. That is, when writing the data of the file, the processor <NUM> may not write it in the storage <NUM> while updating only the cache and, only when necessary, may control the writing in a main memory device or in an auxiliary memory device. Although the writeback has a fast data input speed, data between the cache of the memory <NUM> and the storage <NUM> may have different values because the data is not updated directly to the storage <NUM>. As such, a file having different values in the memory <NUM> and in the storage <NUM> may be referred to as a dirty page. Based on the existence of the dirty page, the processor <NUM> may determine whether processing for the writeback is necessary upon the input or output of the file.

According to an embodiment, the dirty page may denote a file whose contents are different between the memory <NUM> and the storage <NUM>. In case that a file is frequently modified, the contents of the file in the memory <NUM> may be different from those of the file stored in the storage <NUM>. In case of a cold file, a write operation to the storage <NUM> does not occur relatively frequently, and many writes may be performed at once. In this case, because of a low number of times of writes, the cold file may contain relatively many dirty pages. So, the cold file may have relatively many dirty pages, and the electronic device <NUM> may increase the weight of the dirty page count for the cold file after learning through the machine learning.

The processor <NUM> may identify the existence of the dirty page and control the writeback to be performed. At operation <NUM>, the processor <NUM> may control the writeback thread <NUM> to be executed. The writeback thread <NUM> may identify a file type, based on a weight for each feature of a write pattern of the file. At operation <NUM>, the writeback thread <NUM> may load a weight for each feature of a predefined write pattern.

According to an embodiment, the electronic device <NUM> may update a weight of a feature of a write pattern by using the machine learning. For example, in case of performing learning by using a hot file, the electronic device <NUM> may increase weights for the fsync count and the overwrite count. In case of performing learning by using a cold file, the electronic device <NUM> may increase weights for the write chunk, the dirty page count, and the append count. The write chunk may denote an average file size upon a file write request, and in case of a cold file, a file size modified in response to a single write request may be relatively large because the modification is not frequent. Thus, the cold file may have a relatively high write chunk, and the electronic device <NUM> may increase the weight of the write chunk for the cold file after learning through the machine learning. This has been previously described in <FIG>.

At operation <NUM>, the processor <NUM> may predict the type of the file by using the writeback thread <NUM>.

According to an embodiment, in case that the fsync is relatively low, the processor <NUM> may determine that a file recorded in the memory <NUM> is a file with a relatively small number of times being written to the storage <NUM>. That is, in case that the fsync is relatively low, the processor <NUM> may determine that the file is not frequently modified, and classify it as close to a cold file. Conversely, in case that the fsync is relatively high, the processor <NUM> may determine that the file is modified relatively frequently, and classify it as close to a hot file.

Or, in case that the write chunk is relatively small, the processor <NUM> may determine that a small amount of write is performed during one write operation, and classify it as close to a hot file. Conversely, in case that the write chunk is relatively large, the processor <NUM> may determine that a large amount of write is performed during one write operation, and classify it as close to a cold file. This has been previously described in <FIG>.

At operation <NUM>, the processor <NUM> may perform a writeback processing operation in response to identifying the file types, and control classifying the files according to the file types and separately storing the files in a first area (e.g., the first area <NUM> in <FIG>) and a second area (e.g., the second area <NUM> in <FIG>).

For example, in case that an arbitrary file can be classified as the hot file <NUM>, the processor <NUM> may identify whether file information in the memory <NUM> and file information in the storage <NUM> do not match each other due to frequent modification. In response to identifying that the file information in the memory <NUM> and the file information in the storage <NUM> do not match, the processor <NUM> may control an invalid block (e.g., the invalid block <NUM> in <FIG>) stored in the storage <NUM> to be deleted. The invalid block <NUM> may refer to a file in the storage <NUM> containing information before modification in a situation where the file information in the memory <NUM> and the file information in the storage <NUM> do not match. The processor <NUM> may perform a garbage collection operation that deletes the invalid block <NUM> and secures a free space. This has been previously described with reference to <FIG> and <FIG>.

At operation <NUM>, the processor <NUM> may terminate the processes shown in <FIG> when the classification according to the file types is completed or the file writeback processing is not required.

According to various embodiments, an electronic device may include a random access memory, a storage, and a processor. The processor may be configured to write a file of an application in the memory in response to a file input request of the application, to monitor a write pattern of the file at a first time of writing the file of the application in the memory, followed by updating the write pattern in the memory, to classify the file as one of a hot file and a cold file based on the write pattern of the file at a second time of copying the file written in the memory to the storage, and to control storing a classification result of the file together with the file in the storage or storing the file in a first area or a second area of the storage based on the classification result of the file. The hot file is a file whose modification and/or deletion occurs frequently compared to the cold file, and the cold file is a file whose modification and/or deletion occurs infrequently compared to the hot file. The write pattern may include a degree of modification of the file.

According to an embodiment, the write pattern may include at least one of a file size, a dirty page, a file modification time, a file modification interval, a system call count (fsync), a chunk size, a file name extension, a directory name of the file stored, and a use specific file system.

According to an embodiment, the processor may be configured to control learning the write pattern for each file by using machine learning, to assign a weight to at least one of features of the write pattern for the hot file based on a learning result, and to assign a weight to at least one of features of the write pattern for the cold file based on the learning result.

According to an embodiment, the processor may be configured to store the weights learned using the machine learning in the memory, and to control classifying an arbitrary file written in the memory as the hot file or the cold file based on the weights learned using the machine learning at the second time of copying the arbitrary file to the storage.

According to an embodiment, the processor may be configured to, in response to identifying that the file learned using the machine learning is classified as the hot file, control increasing the weight of at least one of, in the write pattern, an overwrite count which denotes the number of times to modify a part of a file in a middle, or an fsync which denotes the number of times to write a file recorded in the memory to the storage.

According to an embodiment, the processor may be configured to, in response to identifying that the file learned using the machine learning is classified as the cold file, control increasing the weight of at least one of a write chunk which denotes a size unit of a file stored in an operation of writing the file in the memory, or a dirty page count which denotes the number of dirty pages whose contents are differently stored in the memory and in the storage.

According to an embodiment, the write pattern may include an overwrite count that denotes the number of times to modify a part of a file in a middle, and the processor may be configured to, in case that the overwrite count of the file is relatively large, classify the file as close to the hot file based on determining that the number of times of modifications of the file is large, and in case that the overwrite count of the file is relatively small, classify the file as close to the cold file based on determining that the number of times of modifications of the file is small.

According to an embodiment, the write pattern may include a write chunk which denotes a size unit of a file stored in an operation of writing the file in the memory, and the processor may be configured to, in case that the write chunk of the file is relatively small, classify the file as close to the hot file based on determining that there is frequent modification, and in case that the write chunk of the file is relatively large, classify the file as close to the cold file based on determining that a large amount of write is performed during one write operation.

According to an embodiment, the write pattern may include an fsync which denotes the number of times to write a file written in the memory to the storage, and the processor may be configured to, in case that the fsync of the file is relatively high, classify the file as close to the hot file based on determining as a file with relatively frequent modification, and in case that the fsync of the file is relatively low, classify the file as close to the cold file based on determining as a file with infrequent modification.

According to an embodiment, the processor may be configured to control the hot file to be stored in the first area, and to control the cold file to be stored in the second area.

According to various embodiments, a file system operating method of an electronic device may include writing a file of an application in a memory in response to a file input request of the application, monitoring a write pattern of the file at a first time of writing the file of the application in the memory, followed by updating the write pattern in the memory, classifying the file as a hot file or a cold file based on the write pattern of the file at a second time of copying the file written in the memory to a storage, and storing a classification result of the file together with the file in the storage or storing the file in a first area or a second area of the storage based on the classification result of the file. The hot file is a file whose modification and/or deletion occurs frequently compared to the cold file, and the cold file is a file whose modification and/or deletion occurs infrequently compared to the hot file. The write pattern may include a degree of modification of the file.

According to an embodiment, monitoring a write pattern of the file at a first time of writing the file of the application in the memory, followed by updating the write pattern in the memory, may include controlling learning the write pattern for each file by using machine learning, and assigning a weight to at least one of features of the write pattern for the hot file and the cold file based on a learning result.

According to an embodiment, classifying the file as a hot file or a cold file based on the write pattern of the file at a second time of copying the file written in the memory to a storage may include storing the weights learned using the machine learning in the memory, and classifying an arbitrary file written in the memory as the hot file or the cold file based on the weights learned using the machine learning at the second time of copying the arbitrary file to the storage.

According to an embodiment, the method may further include, in response to identifying that the file learned using the machine learning is classified as the hot file, controlling increasing the weight of at least one of, in the write pattern, an overwrite count which denotes the number of times to modify a part of a file in a middle, or an fsync which denotes the number of times to write a file recorded in the memory to the storage.

According to an embodiment, the method may further include, in response to identifying that the file learned using the machine learning is classified as the cold file, controlling increasing the weight of at least one of a write chunk which denotes a size unit of a file stored in an operation of writing the file in the memory, or a dirty page count which denotes the number of dirty pages whose contents are differently stored in the memory and in the storage.

According to an embodiment, the write pattern may include an overwrite count that denotes the number of times to modify a part of a file in a middle, and classifying the file as a hot file or a cold file based on the write pattern of the file at a second time of copying the file written in the memory to a storage may include, in case that the overwrite count of the file is relatively large, classifying the file as close to the hot file based on determining that the number of times of modifications of the file is large, and in case that the overwrite count of the file is relatively small, classifying the file as close to the cold file based on determining that the number of times of modifications of the file is small.

According to an embodiment, the write pattern may include a write chunk which denotes a size unit of a file stored in an operation of writing the file in the memory, and classifying the file as a hot file or a cold file based on the write pattern of the file at a second time of copying the file written in the memory to a storage may include, in case that the write chunk of the file is relatively small, classifying the file as close to the hot file based on determining that there is frequent modification, and in case that the write chunk of the file is relatively large, classifying the file as close to the cold file based on determining that a large amount of write is performed during one write operation.

According to an embodiment, the write pattern may include an fsync which denotes the number of times to write a file written in the memory to the storage, and classifying the file as a hot file or a cold file based on the write pattern of the file at a second time of copying the file written in the memory to a storage may include, in case that the fsync of the file is relatively high, classifying the file as close to the hot file based on determining as a file with relatively frequent modification, and in case that the fsync of the file is relatively low, classifying the file as close to the cold file based on determining as a file with infrequent modification.

According to an embodiment, storing a classification result of the file together with the file in the storage or storing the file in a first area or a second area of the storage based on the classification result of the file may include controlling the hot file to be stored in the first area, and controlling the cold file to be stored in the second area.

Claim 1:
An electronic device (<NUM>) comprising:
a memory (<NUM>);
a storage (<NUM>); and
a processor (<NUM>) configured to:
write a file of an application in the memory (<NUM>) in response to a file input request of the application;
identify a write pattern of the file at a first time of writing the file of the application in the memory (<NUM>);
update the write pattern in the memory (<NUM>);
classify the file as one of a hot file and a cold file based on the write pattern of the file at a second time of copying the file of the application from the memory (<NUM>) to the storage (<NUM>); the electronic device being characterized in that the processor is configured to :
store a classification result of the file together with the file in the storage (<NUM>); or
store the file in one of a first area (<NUM>) of the storage and a second area (<NUM>) of the storage based on the classification result of the file,
wherein the file is classified as a hot file based on at least one modification and/or deletion in the file occurring more frequently than a predetermined frequency, and the file is classified as a cold file based on at least one modification and/or deletion in the file occurring less frequently than the predetermined frequency, and
wherein the write pattern comprises a degree of modification of the file,
wherein the processor (<NUM>) is further configured to:
control learning the write pattern for each file by using machine learning;
assign a weight to at least one feature of the write pattern for the hot file based on a learning result; and
assign a weight to at least one feature of the write pattern for the cold file based on the learning result.