Whamcloud - gitweb
Branch b1_6
authorjohann <johann>
Mon, 18 Feb 2008 09:34:19 +0000 (09:34 +0000)
committerjohann <johann>
Mon, 18 Feb 2008 09:34:19 +0000 (09:34 +0000)
b=13400

fix indenting and remove trailing whitespaces in the quota code.

lustre/quota/quota_adjust_qunit.c
lustre/quota/quota_context.c
lustre/quota/quota_interface.c
lustre/quota/quota_master.c

index 078876d..d22c3f9 100644 (file)
@@ -89,8 +89,7 @@ void quota_compute_lqs(struct qunit_data *qdata, struct lustre_qunit_size *lqs,
         }
 }
 
-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);
@@ -103,10 +102,9 @@ void qdata_to_oqaq(struct qunit_data *qdata,
                 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;
@@ -133,8 +131,7 @@ int quota_search_lqs(struct qunit_data *qdata,
         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)
 {
@@ -190,8 +187,8 @@ int quota_create_lqs(struct qunit_data *qdata,
         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;
@@ -204,7 +201,7 @@ int quota_adjust_slave_lqs(struct quota_adjust_qunit *oqaq, struct
                 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  */
@@ -300,8 +297,8 @@ int quota_adjust_slave_lqs(struct quota_adjust_qunit *oqaq, struct
         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;
@@ -330,8 +327,8 @@ int filter_quota_adjust_qunit(struct obd_export *exp, struct
 }
 #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;
@@ -370,8 +367,8 @@ out:
         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;
index 74fd0f0..bb61f07 100644 (file)
 
 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)
@@ -273,9 +273,8 @@ check_cur_qunit(struct obd_device *obd,
 }
 
 /* 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;
@@ -472,8 +471,7 @@ static int split_before_schedule_dqacq(struct obd_device *obd,
 }
 
 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;
@@ -690,8 +688,7 @@ static int got_qunit(struct qunit_waiter *waiter)
 }
 
 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;
@@ -1053,9 +1050,12 @@ static int qslave_recovery_main(void *arg)
                         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,
index 795eaae..7e0d83e 100644 (file)
@@ -1,13 +1,13 @@
 /* -*- 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
@@ -44,7 +44,6 @@
 #include <lprocfs_status.h>
 #include "quota_internal.h"
 
-
 #ifdef __KERNEL__
 
 /* quota proc file handling functions */
@@ -216,7 +215,6 @@ int lprocfs_quota_wr_type(struct file *file, const char *buffer,
 }
 EXPORT_SYMBOL(lprocfs_quota_wr_type);
 
-
 #endif /* LPROCFS */
 
 static int filter_quota_setup(struct obd_device *obd)
@@ -249,12 +247,12 @@ static int filter_quota_setinfo(struct obd_export *exp, 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));
 
@@ -328,9 +326,9 @@ static int filter_quota_getflag(struct obd_device *obd, struct obdo *oa)
                 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);
@@ -649,7 +647,7 @@ static inline int hashfn(struct client_obd *cli, unsigned long id, int type)
 /* 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);
@@ -702,8 +700,7 @@ static void free_qinfo(struct osc_quota_info *oqi)
         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;
@@ -725,8 +722,7 @@ int osc_quota_chkdq(struct client_obd *cli,
         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;
@@ -738,12 +734,12 @@ int osc_quota_setdq(struct client_obd *cli,
         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);
index 1f7f747..16bd3a9 100644 (file)
@@ -34,8 +34,7 @@
 
 #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;
 
@@ -170,7 +169,7 @@ static struct lustre_dquot *lustre_dqget(struct obd_device *obd,
 
         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++;
@@ -403,7 +402,8 @@ out:
         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)) {
@@ -456,10 +456,12 @@ int mds_quota_adjust(struct obd_device *obd, unsigned int qcids[],
                 /* 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:
@@ -513,7 +515,7 @@ int filter_quota_adjust(struct obd_device *obd, unsigned int qcids[],
 
 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;
@@ -665,12 +667,12 @@ int init_admin_quotafiles(struct obd_device *obd, struct obd_quotactl *oqctl)
 
                 /* -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 */
@@ -710,7 +712,7 @@ int init_admin_quotafiles(struct obd_device *obd, struct obd_quotactl *oqctl)
         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;
@@ -748,7 +750,7 @@ int mds_admin_quota_on(struct obd_device *obd, struct obd_quotactl *oqctl)
                 if (!Q_TYPESET(oqctl, i))
                         continue;
 
-                LASSERT(strlen(quotafile) 
+                LASSERT(strlen(quotafile)
                         + sizeof(prefix) <= sizeof(name));
                 sprintf(name, "%s%s", prefix, quotafile);
 
@@ -759,16 +761,19 @@ int mds_admin_quota_on(struct obd_device *obd, struct obd_quotactl *oqctl)
 
                 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;
                                 }
                         }
@@ -783,15 +788,14 @@ int mds_admin_quota_on(struct obd_device *obd, struct obd_quotactl *oqctl)
 
                 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;
                 }
         }
@@ -802,7 +806,7 @@ int mds_admin_quota_on(struct obd_device *obd, struct obd_quotactl *oqctl)
         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;
@@ -929,9 +933,8 @@ out:
 }
 
 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;
@@ -1125,7 +1128,7 @@ static int mds_init_slave_blimits(struct obd_device *obd,
         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;
@@ -1525,7 +1528,7 @@ static int qmaster_recovery_main(void *arg)
                         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);