+static char *find_cgroup_mnt(struct thread_data *td)
+{
+ char *mntpoint = NULL;
+ struct mntent *mnt, dummy;
+ char buf[256] = {0};
+ FILE *f;
+
+ f = setmntent("/proc/mounts", "r");
+ if (!f) {
+ td_verror(td, errno, "setmntent /proc/mounts");
+ return NULL;
+ }
+
+ while ((mnt = getmntent_r(f, &dummy, buf, sizeof(buf))) != NULL) {
+ if (!strcmp(mnt->mnt_type, "cgroup") &&
+ strstr(mnt->mnt_opts, "blkio"))
+ break;
+ }
+
+ if (mnt)
+ mntpoint = smalloc_strdup(mnt->mnt_dir);
+ else
+ log_err("fio: cgroup blkio does not appear to be mounted\n");
+
+ endmntent(f);
+ return mntpoint;
+}
+
+static void add_cgroup(struct thread_data *td, const char *name,
+ struct flist_head *clist)