char *buf = NULL;
struct obd_ioctl_data *data = NULL;
__u32 type;
+ __u32 flags;
int len = 0, rc;
if (!inode || !(sbi = ll_i2sbi(inode)))
GOTO(out_statfs, rc = -EINVAL);
memcpy(&type, data->ioc_inlbuf1, sizeof(__u32));
- if (type == LL_STATFS_LMV)
+ if (type & LL_STATFS_LMV)
exp = sbi->ll_md_exp;
- else if (type == LL_STATFS_LOV)
+ else if (type & LL_STATFS_LOV)
exp = sbi->ll_dt_exp;
else
GOTO(out_statfs, rc = -ENODEV);
- rc = obd_iocontrol(IOC_OBD_STATFS, exp, len, buf, NULL);
+ flags = (type & LL_STATFS_NODELAY) ? OBD_STATFS_NODELAY : 0;
+ rc = obd_iocontrol(IOC_OBD_STATFS, exp, len, buf, &flags);
if (rc)
GOTO(out_statfs, rc);
out_statfs:
struct obd_device *osc_obd;
struct obd_statfs stat_buf = {0};
__u32 index;
+ __u32 flags;
memcpy(&index, data->ioc_inlbuf2, sizeof(__u32));
if ((index >= count))
(int) sizeof(struct obd_uuid))))
RETURN(-EFAULT);
+ flags = uarg ? *(__u32*)uarg : 0;
/* got statfs data */
rc = obd_statfs(NULL, lov->lov_tgts[index]->ltd_exp, &stat_buf,
cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
- 0);
+ flags);
if (rc)
RETURN(rc);
if (cfs_copy_to_user(data->ioc_pbuf1, &stat_buf,
{"df", lfs_df, 0,
"report filesystem disk space usage or inodes usage"
"of each MDS and all OSDs or a batch belonging to a specific pool .\n"
- "Usage: df [-i] [-h] [--pool|-p <fsname>[.<pool>] [path]"},
+ "Usage: df [-i] [-h] [--lazy|-l] [--pool|-p <fsname>[.<pool>] [path]"},
{"getname", lfs_getname, 0, "list instances and specified mount points "
"[for specified path only]\n"
"Usage: getname [-h]|[path ...] "},
char *st_name;
};
-static int mntdf(char *mntdir, char *fsname, char *pool, int ishow, int cooked)
+static int mntdf(char *mntdir, char *fsname, char *pool, int ishow,
+ int cooked, int lazy)
{
struct obd_statfs stat_buf, sum = { .os_bsize = 1 };
struct obd_uuid uuid_buf;
{ 0, NULL } };
struct ll_stat_type *tp;
__u32 index;
+ __u32 type;
int rc;
if (pool) {
for (index = 0; ; index++) {
memset(&stat_buf, 0, sizeof(struct obd_statfs));
memset(&uuid_buf, 0, sizeof(struct obd_uuid));
- rc = llapi_obd_statfs(mntdir, tp->st_op, index,
+ type = lazy ? tp->st_op | LL_STATFS_NODELAY : tp->st_op;
+ rc = llapi_obd_statfs(mntdir, type, index,
&stat_buf, &uuid_buf);
if (rc == -ENODEV)
break;
{
char mntdir[PATH_MAX] = {'\0'}, path[PATH_MAX] = {'\0'};
int ishow = 0, cooked = 0;
+ int lazy = 0;
int c, rc = 0, index = 0;
char fsname[PATH_MAX] = "", *pool_name = NULL;
struct option long_opts[] = {
{"pool", required_argument, 0, 'p'},
+ {"lazy", 0, 0, 'l'},
{0, 0, 0, 0}
};
optind = 0;
- while ((c = getopt_long(argc, argv, "hip:", long_opts, NULL)) != -1) {
+ while ((c = getopt_long(argc, argv, "hilp:", long_opts, NULL)) != -1) {
switch (c) {
case 'i':
ishow = 1;
case 'h':
cooked = 1;
break;
+ case 'l':
+ lazy = 1;
case 'p':
pool_name = optarg;
break;
if (mntdir[0] == '\0')
continue;
- rc = mntdf(mntdir, fsname, pool_name, ishow, cooked);
+ rc = mntdf(mntdir, fsname, pool_name, ishow, cooked, lazy);
if (rc || path[0] != '\0')
break;
fsname[0] = '\0'; /* avoid matching in next loop */