From 19147a7b7c664691ec70c77994c58f6787f1d6e0 Mon Sep 17 00:00:00 2001 From: "Glenn K. Lockwood" Date: Wed, 18 May 2016 21:39:00 -0700 Subject: [PATCH] checkpoint of code that populates OST and MDT counts per file system--doesn't seem to work though... --- darshan-runtime/lib/darshan-core.c | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/darshan-runtime/lib/darshan-core.c b/darshan-runtime/lib/darshan-core.c index ed6cf45..7917740 100644 --- a/darshan-runtime/lib/darshan-core.c +++ b/darshan-runtime/lib/darshan-core.c @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include #include #include @@ -30,6 +32,9 @@ #include "darshan-core.h" #include "darshan-dynamic.h" +/* XXX stick this into autoconf .h */ +#include + extern char* __progname; extern char* __progname_full; @@ -961,6 +966,34 @@ static void add_entry(char* trailing_data, int* space_left, struct mntent *entry else mnt_data_array[mnt_data_count].fs_info.block_size = 4096; + /* attempt to retrieve OST and MDS counts from Lustre */ + mnt_data_array[mnt_data_count].fs_info.ost_count = -1; + mnt_data_array[mnt_data_count].fs_info.mdt_count = -1; + if ( statfsbuf.f_type == LL_SUPER_MAGIC ) + { + int n_ost, n_mdt; + int ret_ost, ret_mdt; + DIR *mount_dir; + + mount_dir = opendir( entry->mnt_dir ); + if ( mount_dir ) + { + /* n_ost and n_mdt are used for both input and output to ioctl */ + n_ost = 0; + n_mdt = 1; + + ret_ost = ioctl( dirfd(mount_dir), LL_IOC_GETOBDCOUNT, &n_ost ); + ret_mdt = ioctl( dirfd(mount_dir), LL_IOC_GETOBDCOUNT, &n_mdt ); + + if ( ret_ost < 0 || ret_mdt < 0 ) + { + mnt_data_array[mnt_data_count].fs_info.ost_count = n_ost; + mnt_data_array[mnt_data_count].fs_info.mdt_count = n_mdt; + } + closedir( mount_dir ); + } + } + /* store mount information for use in header of darshan log */ ret = snprintf(tmp_mnt, 256, "\n%s\t%s", entry->mnt_type, entry->mnt_dir); -- 2.26.2