A device implementing a system for defragmenting metadata of a filesystem includes a processor configured to, in response to receiving a trigger from a server remote from the device, obtain the metadata from a first data structure, the first data structure comprising a first set of one or more nodes and a second set of one or more nodes, and insert the metadata obtained from the first data structure into a third set of one or more nodes of a second data structure, wherein the third set of one or more nodes omits one or more entries from the second set of nodes. The at least one processor is further configured to, in accordance with a determination that the metadata was successfully inserted into the second data structure, provide the second data structure as a replacement of the first data structure for the filesystem.
展开▼