The following changes since commit d77431b5975096bfd9aafb431c0aa656c9ae8fa8: Only use true random generator for initial seed (2010-03-25 23:31:50 +0100) are available in the git repository at: git://git.kernel.dk/fio.git master Jens Axboe (1): sfree(NULL) is ok Vivek Goyal (1): Add an option "cgroup_nodelete" to not delete cgroups after job completion HOWTO | 6 ++++++ cgroup.c | 12 ++++++++---- filesetup.c | 7 ++----- fio.1 | 6 ++++++ fio.c | 3 +-- fio.h | 1 + options.c | 7 +++++++ 7 files changed, 31 insertions(+), 11 deletions(-) --- Diff of recent changes: diff --git a/HOWTO b/HOWTO index 6c7f05b..922db2f 100644 --- a/HOWTO +++ b/HOWTO @@ -1036,6 +1036,12 @@ cgroup_weight=int Set the weight of the cgroup to this value. See the documentation that comes with the kernel, allowed values are in the range of 100..1000. +cgroup_nodelete=bool Normally fio will delete the cgroups it has created after + the job completion. To override this behavior and to leave + cgroups around after the job completion, set cgroup_nodelete=1. + This can be useful if one wants to inspect various cgroup + files after job completion. Default: false + uid=int Instead of running as the invoking user, set the user ID to this value before the thread/process does any work. diff --git a/cgroup.c b/cgroup.c index 14bbc57..0e3a71e 100644 --- a/cgroup.c +++ b/cgroup.c @@ -14,6 +14,7 @@ static struct fio_mutex *lock; struct cgroup_member { struct flist_head list; char *root; + unsigned int cgroup_nodelete; }; static char *find_cgroup_mnt(struct thread_data *td) @@ -43,14 +44,16 @@ static char *find_cgroup_mnt(struct thread_data *td) return mntpoint; } -static void add_cgroup(const char *name, struct flist_head *clist) +static void add_cgroup(struct thread_data *td, const char *name, + struct flist_head *clist) { struct cgroup_member *cm; cm = smalloc(sizeof(*cm)); INIT_FLIST_HEAD(&cm->list); cm->root = smalloc_strdup(name); - + if (td->o.cgroup_nodelete) + cm->cgroup_nodelete = 1; fio_mutex_down(lock); flist_add_tail(&cm->list, clist); fio_mutex_up(lock); @@ -65,7 +68,8 @@ void cgroup_kill(struct flist_head *clist) flist_for_each_safe(n, tmp, clist) { cm = flist_entry(n, struct cgroup_member, list); - rmdir(cm->root); + if (!cm->cgroup_nodelete) + rmdir(cm->root); flist_del(&cm->list); sfree(cm->root); sfree(cm); @@ -144,7 +148,7 @@ int cgroup_setup(struct thread_data *td, struct flist_head *clist, char **mnt) goto err; } } else - add_cgroup(root, clist); + add_cgroup(td, root, clist); if (td->o.cgroup_weight) { if (write_int_to_file(td, root, "blkio.weight", diff --git a/filesetup.c b/filesetup.c index c188981..32b8b2e 100644 --- a/filesetup.c +++ b/filesetup.c @@ -746,11 +746,8 @@ void close_and_free_files(struct thread_data *td) sfree(f->file_name); f->file_name = NULL; - - if (f->file_map) { - sfree(f->file_map); - f->file_map = NULL; - } + sfree(f->file_map); + f->file_map = NULL; sfree(f); } diff --git a/fio.1 b/fio.1 index 5d0988b..12146c8 100644 --- a/fio.1 +++ b/fio.1 @@ -762,6 +762,12 @@ your system doesn't have it mounted, you can do so with: Set the weight of the cgroup to this value. See the documentation that comes with the kernel, allowed values are in the range of 100..1000. .TP +.BI cgroup_nodelete \fR=\fPbool +Normally fio will delete the cgroups it has created after the job completion. +To override this behavior and to leave cgroups around after the job completion, +set cgroup_nodelete=1. This can be useful if one wants to inspect various +cgroup files after job completion. Default: false +.TP .BI uid \fR=\fPint Instead of running as the invoking user, set the user ID to this value before the thread/process does any work. diff --git a/fio.c b/fio.c index 03dc6cc..ae62d23 100644 --- a/fio.c +++ b/fio.c @@ -1694,8 +1694,7 @@ int main(int argc, char *argv[]) cgroup_kill(cgroup_list); sfree(cgroup_list); - if (cgroup_mnt) - sfree(cgroup_mnt); + sfree(cgroup_mnt); fio_mutex_remove(startup_mutex); fio_mutex_remove(writeout_mutex); diff --git a/fio.h b/fio.h index 5038e4d..5dc0352 100644 --- a/fio.h +++ b/fio.h @@ -281,6 +281,7 @@ struct thread_options { */ char *cgroup; unsigned int cgroup_weight; + unsigned int cgroup_nodelete; unsigned int uid; unsigned int gid; diff --git a/options.c b/options.c index 974df33..994f2a1 100644 --- a/options.c +++ b/options.c @@ -1818,6 +1818,13 @@ static struct fio_option options[FIO_MAX_OPTS] = { .maxval = 1000, }, { + .name = "cgroup_nodelete", + .type = FIO_OPT_BOOL, + .off1 = td_var_offset(cgroup_nodelete), + .help = "Do not delete cgroups after job completion", + .def = "0", + }, + { .name = "uid", .type = FIO_OPT_INT, .off1 = td_var_offset(uid), -- To unsubscribe from this list: send the line "unsubscribe fio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html