CernVM-FS  2.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
garbage_collector.cc File Reference
#include "garbage_collector.h"
#include <dirent.h>
#include <errno.h>
#include <stdio.h>
#include <map>
#include <string>
#include "helpers.h"
#include "logging.h"
#include "shrinkwrap/fs_traversal.h"
#include "smalloc.h"
#include "util/posix.h"
Include dependency graph for garbage_collector.cc:

Go to the source code of this file.

Functions

void InitializeGarbageCollection (struct fs_traversal_context *ctx)
 
void FinalizeGarbageCollection (struct fs_traversal_context *ctx)
 
void * PosixGcMainWorker (void *data)
 
int RunGarbageCollection (struct fs_traversal_context *ctx)
 

Function Documentation

void FinalizeGarbageCollection ( struct fs_traversal_context ctx)

Finalizes the garbage collection Stores the content of the garbage collection hash map in the file at [data directory] + POSIX_GARBAGE_DIR + POSIX_GARBAGE_FLAGGED_FILE

Definition at line 59 of file garbage_collector.cc.

Referenced by FinalizeFsOperations().

Here is the caller graph for this function:

void InitializeGarbageCollection ( struct fs_traversal_context ctx)

This file is part of the CernVM File System. Initializes garbage collection by setting up the corresponding hash map in the fs_traversal_posix_context The initialization uses the data stored in the file at [data directory] + POSIX_GARBAGE_DIR + POSIX_GARBAGE_FLAGGED_FILE

This file contains a fixed length concatenation of inodes (type ino_t) which should be checked and deleted upon garbage collection

Definition at line 29 of file garbage_collector.cc.

Referenced by InitialFsOperations().

Here is the call graph for this function:

Here is the caller graph for this function:

void* PosixGcMainWorker ( void *  data)

Main Worker of the Posix Garbage Collector Iterates over a calculated set of directories and check for inodes that can be deleted. For the thread with thread number j the thread starts with the top level data directory /j/ and iterates over the contained files. Afterwards it continues with /j+i*n/ where n is the number of total threads and i is an arbitrary integer.

Definition at line 85 of file garbage_collector.cc.

Referenced by RunGarbageCollection().

Here is the call graph for this function:

Here is the caller graph for this function:

int RunGarbageCollection ( struct fs_traversal_context ctx)

Method which runs the garbage collection. Will start posix_ctx->num_threads in parallel for the task. For posix_ctx->num_threads <= 1 there is a fallback to a sequential version.

Definition at line 160 of file garbage_collector.cc.

Referenced by posix_garbage_collector().

Here is the call graph for this function:

Here is the caller graph for this function: