}
}
-void qdata_to_oqaq(struct qunit_data *qdata,
- struct quota_adjust_qunit *oqaq)
+void qdata_to_oqaq(struct qunit_data *qdata, struct quota_adjust_qunit *oqaq)
{
LASSERT(qdata);
LASSERT(oqaq);
oqaq->qaq_iunit_sz = qdata->qd_qunit;
}
-int quota_search_lqs(struct qunit_data *qdata,
- struct quota_adjust_qunit *oqaq,
- struct lustre_quota_ctxt *qctxt,
- struct lustre_qunit_size **lqs_return)
+int quota_search_lqs(struct qunit_data *qdata, struct quota_adjust_qunit *oqaq,
+ struct lustre_quota_ctxt *qctxt,
+ struct lustre_qunit_size **lqs_return)
{
struct quota_adjust_qunit *oqaq_tmp = NULL;
ENTRY;
RETURN(0);
}
-int quota_create_lqs(struct qunit_data *qdata,
- struct quota_adjust_qunit *oqaq,
+int quota_create_lqs(struct qunit_data *qdata, struct quota_adjust_qunit *oqaq,
struct lustre_quota_ctxt *qctxt,
struct lustre_qunit_size **lqs_return)
{
RETURN(rc);
}
-int quota_adjust_slave_lqs(struct quota_adjust_qunit *oqaq, struct
- lustre_quota_ctxt *qctxt)
+int quota_adjust_slave_lqs(struct quota_adjust_qunit *oqaq,
+ struct lustre_quota_ctxt *qctxt)
{
struct lustre_qunit_size *lqs = NULL;
unsigned long *lbunit, *liunit, *lbtune, *litune;
RETURN(0);
LASSERT(qctxt);
- search_lqs:
+search_lqs:
rc = quota_search_lqs(NULL, oqaq, qctxt, &lqs);
/* deleting the lqs, because a user sets lfs quota 0 0 0 0 */
RETURN(rc);
}
-int filter_quota_adjust_qunit(struct obd_export *exp, struct
- quota_adjust_qunit *oqaq)
+int filter_quota_adjust_qunit(struct obd_export *exp,
+ struct quota_adjust_qunit *oqaq)
{
struct obd_device *obd = exp->exp_obd;
struct lustre_quota_ctxt *qctxt = &obd->u.obt.obt_qctxt;
}
#endif /* __KERNEL__ */
-int client_quota_adjust_qunit(struct obd_export *exp, struct
- quota_adjust_qunit *oqaq)
+int client_quota_adjust_qunit(struct obd_export *exp,
+ struct quota_adjust_qunit *oqaq)
{
struct ptlrpc_request *req;
struct quota_adjust_qunit *oqa;
RETURN (rc);
}
-int lov_quota_adjust_qunit(struct obd_export *exp, struct
- quota_adjust_qunit *oqaq)
+int lov_quota_adjust_qunit(struct obd_export *exp,
+ struct quota_adjust_qunit *oqaq)
{
struct obd_device *obd = class_exp2obd(exp);
struct lov_obd *lov = &obd->u.lov;
extern struct lustre_hash_operations lqs_hash_operations;
-unsigned long default_bunit_sz = 128 * 1024 * 1024; /* 128M bytes */
-unsigned long default_btune_ratio = 50; /* 50 percentage */
-unsigned long default_iunit_sz = 5120; /* 5120 inodes */
-unsigned long default_itune_ratio = 50; /* 50 percentage */
+unsigned long default_bunit_sz = 128 * 1024 * 1024; /* 128M bytes */
+unsigned long default_btune_ratio = 50; /* 50 percentage */
+unsigned long default_iunit_sz = 5120; /* 5120 inodes */
+unsigned long default_itune_ratio = 50; /* 50 percentage */
cfs_mem_cache_t *qunit_cachep = NULL;
struct list_head qunit_hash[NR_DQHASH];
spinlock_t qunit_hash_lock = SPIN_LOCK_UNLOCKED;
struct lustre_qunit {
- struct list_head lq_hash; /* Hash list in memory */
- atomic_t lq_refcnt; /* Use count */
- struct lustre_quota_ctxt *lq_ctxt; /* Quota context this applies to */
- struct qunit_data lq_data; /* See qunit_data */
- unsigned int lq_opc; /* QUOTA_DQACQ, QUOTA_DQREL */
- struct list_head lq_waiters; /* All write threads waiting for this qunit */
+ struct list_head lq_hash; /* Hash list in memory */
+ atomic_t lq_refcnt; /* Use count */
+ struct lustre_quota_ctxt *lq_ctxt; /* Quota context this applies to */
+ struct qunit_data lq_data; /* See qunit_data */
+ unsigned int lq_opc; /* QUOTA_DQACQ, QUOTA_DQREL */
+ struct list_head lq_waiters; /* Threads waiting for this qunit */
};
int should_translate_quota (struct obd_import *imp)
}
/* compute the remaining quota for certain gid or uid b=11693 */
-int compute_remquota(struct obd_device *obd,
- struct lustre_quota_ctxt *qctxt, struct qunit_data *qdata,
- int isblk)
+int compute_remquota(struct obd_device *obd, struct lustre_quota_ctxt *qctxt,
+ struct qunit_data *qdata, int isblk)
{
struct super_block *sb = qctxt->lqc_sb;
__u64 usage, limit;
}
static int
-dqacq_completion(struct obd_device *obd,
- struct lustre_quota_ctxt *qctxt,
+dqacq_completion(struct obd_device *obd, struct lustre_quota_ctxt *qctxt,
struct qunit_data *qdata, int rc, int opc)
{
struct lustre_qunit *qunit = NULL;
}
static int
-schedule_dqacq(struct obd_device *obd,
- struct lustre_quota_ctxt *qctxt,
+schedule_dqacq(struct obd_device *obd, struct lustre_quota_ctxt *qctxt,
struct qunit_data *qdata, int opc, int wait)
{
struct lustre_qunit *qunit, *empty;
if (ret > 0) {
int opc;
opc = ret == 1 ? QUOTA_DQACQ : QUOTA_DQREL;
- rc = split_before_schedule_dqacq(obd, qctxt, &qdata, opc, 0);
- } else
+ rc = split_before_schedule_dqacq(obd, qctxt,
+ &qdata, opc,
+ 0);
+ } else {
rc = 0;
+ }
if (rc)
CDEBUG(rc == -EBUSY ? D_QUOTA : D_ERROR,
/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
* vim:expandtab:shiftwidth=8:tabstop=8:
*
- * lustre/quota/quota_interface.c
+ * lustre/quota/quota_interface.c
*
- * Copyright (c) 2001-2005 Cluster File Systems, Inc.
+ * Copyright (c) 2001-2005 Cluster File Systems, Inc.
*
- * This file is part of Lustre, http://www.lustre.org.
+ * This file is part of Lustre, http://www.lustre.org.
*
- * No redistribution or use is permitted outside of Cluster File Systems, Inc.
+ * No redistribution or use is permitted outside of Cluster File Systems, Inc.
*
*/
#ifndef EXPORT_SYMTAB
#include <lprocfs_status.h>
#include "quota_internal.h"
-
#ifdef __KERNEL__
/* quota proc file handling functions */
}
EXPORT_SYMBOL(lprocfs_quota_wr_type);
-
#endif /* LPROCFS */
static int filter_quota_setup(struct obd_device *obd)
obd->u.obt.obt_qctxt.lqc_import = exp->exp_imp_reverse;
spin_unlock(&obd->u.obt.obt_qctxt.lqc_lock);
- /* make imp's connect flags equal relative exp's connect flags
+ /* make imp's connect flags equal relative exp's connect flags
* adding it to avoid the scan export list
*/
imp = exp->exp_imp_reverse;
if (imp)
- imp->imp_connect_data.ocd_connect_flags |=
+ imp->imp_connect_data.ocd_connect_flags |=
(exp->exp_connect_flags &
(OBD_CONNECT_QUOTA64 | OBD_CONNECT_CHANGE_QS));
oa->o_valid |= (cnt == USRQUOTA) ?
OBD_MD_FLUSRQUOTA : OBD_MD_FLGRPQUOTA;
if (oqctl->qc_dqblk.dqb_bhardlimit &&
- (toqb(oqctl->qc_dqblk.dqb_curspace) >
+ (toqb(oqctl->qc_dqblk.dqb_curspace) >
oqctl->qc_dqblk.dqb_bhardlimit))
- oa->o_flags |= (cnt == USRQUOTA) ?
+ oa->o_flags |= (cnt == USRQUOTA) ?
OBD_FL_NO_USRQUOTA : OBD_FL_NO_GRPQUOTA;
}
OBD_FREE_PTR(oqctl);
/* caller must hold qinfo_list_lock */
static inline void insert_qinfo_hash(struct osc_quota_info *oqi)
{
- struct list_head *head = qinfo_hash +
+ struct list_head *head = qinfo_hash +
hashfn(oqi->oqi_cli, oqi->oqi_id, oqi->oqi_type);
LASSERT_SPIN_LOCKED(&qinfo_list_lock);
OBD_SLAB_FREE(oqi, qinfo_cachep, sizeof(*oqi));
}
-int osc_quota_chkdq(struct client_obd *cli,
- unsigned int uid, unsigned int gid)
+int osc_quota_chkdq(struct client_obd *cli, unsigned int uid, unsigned int gid)
{
unsigned int id;
int cnt, rc = QUOTA_OK;
RETURN(rc);
}
-int osc_quota_setdq(struct client_obd *cli,
- unsigned int uid, unsigned int gid,
+int osc_quota_setdq(struct client_obd *cli, unsigned int uid, unsigned int gid,
obd_flag valid, obd_flag flags)
{
unsigned int id;
for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
struct osc_quota_info *oqi, *old;
- if (!(valid & ((cnt == USRQUOTA) ?
+ if (!(valid & ((cnt == USRQUOTA) ?
OBD_MD_FLUSRQUOTA : OBD_MD_FLGRPQUOTA)))
continue;
id = (cnt == USRQUOTA) ? uid : gid;
- noquota = (cnt == USRQUOTA) ?
+ noquota = (cnt == USRQUOTA) ?
(flags & OBD_FL_NO_USRQUOTA) : (flags & OBD_FL_NO_GRPQUOTA);
oqi = alloc_qinfo(cli, id, cnt);
#include "quota_internal.h"
-/* lock ordering:
- * mds->mds_qonoff_sem > dquot->dq_sem */
+/* lock ordering: mds->mds_qonoff_sem > dquot->dq_sem */
static struct list_head lustre_dquot_hash[NR_DQHASH];
static spinlock_t dquot_hash_lock = SPIN_LOCK_UNLOCKED;
if ((empty = alloc_dquot(lqi, id, type)) == NULL)
RETURN(ERR_PTR(-ENOMEM));
-
+
spin_lock(&dquot_hash_lock);
if ((dquot = find_dquot(hashent, lqi, id, type)) != NULL) {
dquot->dq_refcnt++;
up(&mds->mds_qonoff_sem);
lustre_dqput(dquot);
if (rc != -EDQUOT)
- dqacq_adjust_qunit_sz(obd, qdata->qd_id, QDATA_IS_GRP(qdata), QDATA_IS_BLK(qdata));
+ dqacq_adjust_qunit_sz(obd, qdata->qd_id, QDATA_IS_GRP(qdata),
+ QDATA_IS_BLK(qdata));
quota_search_lqs(qdata, NULL, qctxt, &lqs);
if (QDATA_IS_BLK(qdata)) {
/* fall-through */
case FSFILT_OP_CREATE:
case FSFILT_OP_UNLINK:
- /* acquire/release file/block quota on owner of child (or current owner) */
+ /* acquire/release file/block quota on owner of child
+ * (or current owner) */
rc2 |= qctxt_adjust_qunit(obd, qctxt, qcids[0], qcids[1], 0, 0);
rc2 |= qctxt_adjust_qunit(obd, qctxt, qcids[0], qcids[1], 1, 0);
- /* acquire/release block quota on owner of parent (or original owner) */
+ /* acquire/release block quota on owner of parent
+ * (or original owner) */
rc2 |= qctxt_adjust_qunit(obd, qctxt, qpids[0], qpids[1], 1, 0);
break;
default:
static const char prefix[] = "OBJECTS/";
-int mds_quota_get_version(struct obd_device *obd,
+int mds_quota_get_version(struct obd_device *obd,
lustre_quota_version_t *version)
{
struct mds_obd *mds = &obd->u.mds;
/* -EINVAL may be returned by quotainfo for bad quota file */
if (rc != -ENOENT && rc != -EINVAL) {
- CERROR("error opening old quota file %s (%d)\n",
+ CERROR("error opening old quota file %s (%d)\n",
name, rc);
break;
}
- CDEBUG(D_INFO, "%s new quota file %s\n", name,
+ CDEBUG(D_INFO, "%s new quota file %s\n", name,
rc == -ENOENT ? "creating" : "overwriting");
/* create quota file overwriting old if needed */
RETURN(rc);
}
-static int close_quota_files(struct obd_quotactl *oqctl,
+static int close_quota_files(struct obd_quotactl *oqctl,
struct lustre_quota_info *qinfo)
{
int i, rc = 0;
if (!Q_TYPESET(oqctl, i))
continue;
- LASSERT(strlen(quotafile)
+ LASSERT(strlen(quotafile)
+ sizeof(prefix) <= sizeof(name));
sprintf(name, "%s%s", prefix, quotafile);
fp = filp_open(name, O_RDWR, 0);
/* handle transparent migration to 64 bit quota file */
- if (IS_ERR(fp) && PTR_ERR(fp) == -ENOENT &&
+ if (IS_ERR(fp) && PTR_ERR(fp) == -ENOENT &&
qinfo->qi_version == LUSTRE_QUOTA_V2) {
- CDEBUG(D_INFO, "attempting to convert V1 quota file to V2 format.\n");
+ CDEBUG(D_INFO, "attempting to convert V1 quota file to"
+ " V2 format\n");
fp = filp_open(name, O_CREAT | O_TRUNC, 0644);
if (!IS_ERR(fp)) {
qinfo->qi_files[i] = fp;
rc = fsfilt_quotainfo(obd, qinfo, i, QFILE_CONVERT);
if (rc) {
- CERROR("error convert %s admin quotafile! (rc:%d)\n",
- i == USRQUOTA ? "user" : "group", rc);
+ CERROR("error convert %s admin "
+ "quotafile! (rc:%d)\n",
+ i == USRQUOTA ? "user" : "group",
+ rc);
break;
}
}
rc = fsfilt_quotainfo(obd, qinfo, i, QFILE_CHK);
if (rc) {
- CERROR("invalid quota file %s! (rc:%d)\n",
- name, rc);
+ CERROR("invalid quota file %s! (rc:%d)\n", name, rc);
break;
}
rc = fsfilt_quotainfo(obd, qinfo, i, QFILE_RD_INFO);
if (rc) {
- CERROR("error read quotainfo of %s! (rc:%d)\n",
- name, rc);
+ CERROR("error read quotainfo of %s! (rc:%d)\n", name,
+ rc);
break;
}
}
RETURN(rc);
}
-static int mds_admin_quota_off(struct obd_device *obd,
+static int mds_admin_quota_off(struct obd_device *obd,
struct obd_quotactl *oqctl)
{
struct mds_obd *mds = &obd->u.mds;
}
int dquot_create_oqaq(struct lustre_quota_ctxt *qctxt,
- struct lustre_dquot *dquot, __u32 ost_num,
- __u32 mdt_num, int type,
- struct quota_adjust_qunit *oqaq)
+ struct lustre_dquot *dquot, __u32 ost_num, __u32 mdt_num,
+ int type, struct quota_adjust_qunit *oqaq)
{
__u64 bunit_curr_o, iunit_curr_o;
unsigned long shrink_qunit_limit = qctxt->lqc_cqs_boundary_factor;
if (!ioqc)
RETURN(-ENOMEM);
- flag = oqctl->qc_dqblk.dqb_bhardlimit ||
+ flag = oqctl->qc_dqblk.dqb_bhardlimit ||
oqctl->qc_dqblk.dqb_bsoftlimit || set;
ioqc->qc_cmd = flag ? Q_INITQUOTA : Q_SETQUOTA;
ioqc->qc_id = oqctl->qc_id;
continue;
}
INIT_LIST_HEAD(&id_list);
- rc = fsfilt_qids(obd, qinfo->qi_files[type], NULL, type,
+ rc = fsfilt_qids(obd, qinfo->qi_files[type], NULL, type,
&id_list);
up(&mds->mds_qonoff_sem);