X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fquota%2Flproc_quota.c;h=977079fd1ca0dbe86bc99b03ab06a069bbc5f367;hb=refs%2Fchanges%2F40%2F38440%2F11;hp=034a2690e3c0479c280a32a83a41acac6d0285b0;hpb=a00a07567d4909251e58900a9e5ea27157960fd4;p=fs%2Flustre-release.git diff --git a/lustre/quota/lproc_quota.c b/lustre/quota/lproc_quota.c index 034a269..977079f 100644 --- a/lustre/quota/lproc_quota.c +++ b/lustre/quota/lproc_quota.c @@ -21,7 +21,7 @@ * GPL HEADER END */ /* - * Copyright (c) 2011, 2015, Intel Corporation. + * Copyright (c) 2011, 2017, Intel Corporation. * Use is subject to license terms. * * Author: Johann Lombardi @@ -172,6 +172,9 @@ static inline const char *oid2name(__u32 oid) return "usr_accounting"; case ACCT_GROUP_OID: return "grp_accounting"; + case ACCT_PROJECT_OID: + return "prj_accounting"; + break; default: return "unknown_accounting"; } @@ -209,13 +212,13 @@ static int lprocfs_quota_seq_show(struct seq_file *p, void *v) if (fid_is_acct(fid)) { seq_printf(p, "%s:\n", oid2name(fid_oid(fid))); } else if (fid_seq(fid) == FID_SEQ_QUOTA_GLB) { - int poolid, rtype, qtype; + int rtype, qtype; - rc = lquota_extract_fid(fid, &poolid, &rtype, &qtype); + rc = lquota_extract_fid(fid, &rtype, &qtype); if (rc) return rc; - seq_printf(p, "global_pool%d_%s_%s\n", poolid, + seq_printf(p, "global_pool%d_%s_%s\n", 0, RES_NAME(rtype), qtype_name(qtype)); } else if (fid_seq(fid) == FID_SEQ_LOCAL_NAME) { /* global index copy object */ @@ -297,14 +300,15 @@ static int lprocfs_quota_seq_open(struct inode *inode, struct file *file) goto out_lqp; } - rc = LPROCFS_ENTRY_CHECK(inode); - if (rc < 0) - goto out_env; - rc = seq_open(file, &lprocfs_quota_seq_sops); if (rc) goto out_env; + if (!lqp->lqp_obj) { + lqp->lqp_it = NULL; + goto out_seq; + } + /* initialize iterator */ iops = &lqp->lqp_obj->do_index_ops->dio_it; it = iops->init(&lqp->lqp_env, lqp->lqp_obj, 0); @@ -319,6 +323,7 @@ static int lprocfs_quota_seq_open(struct inode *inode, struct file *file) lqp->lqp_it = it; lqp->lqp_cookie = 0; +out_seq: seq = file->private_data; seq->private = lqp; return 0; @@ -337,9 +342,10 @@ static int lprocfs_quota_seq_release(struct inode *inode, struct file *file) const struct dt_it_ops *iops; LASSERT(lqp); - iops = &lqp->lqp_obj->do_index_ops->dio_it; - if (lqp->lqp_it != NULL) + if (lqp->lqp_it != NULL) { + iops = &lqp->lqp_obj->do_index_ops->dio_it; iops->fini(&lqp->lqp_env, lqp->lqp_it); + } lu_env_fini(&lqp->lqp_env); OBD_FREE_PTR(lqp);