Patent ID: 8583859

Claim:
A storage controller for a storage comprising a plurality of blocks in units of which data is erased, the blocks configured to store data, the storage controller comprising: a condition storage configured to store, with respect to each of the plurality of blocks, block condition information comprising at least one of erasure time information indicative of a latest time of data erasure and erasure count information indicative of a number of times data has been erased from the block; a determination module configured to determine whether to perform wear leveling on each of the plurality of blocks, based on the block condition information stored in the condition storage; a wear-leveling block retainer configured to retain block identification information indicative of a block identified for wear leveling by the determination module; a data transfer controller configured to: perform compaction by collecting data stored in at least two blocks of the plurality of blocks and transferring the data into another block; and transfer data stored in the block indicated in the block identification information when the wear-leveling block retainer retains block identification information; a compaction block retainer configured to retain block identification information indicative of a block to be a transfer origin when the data transfer controller performs compaction; and a prevention module configured to prevent the same block identification information from being retained by the wear-leveling block retainer and the compaction block retainer at the same time, wherein the data transfer controller is further configured to transfer the data stored in the block indicated in the block identification information retained by the wear-leveling block retainer, and to perform the compaction on blocks indicated in the block identification information retained by the compaction block retainer.