* GPL HEADER END
*/
/*
- * Copyright (c) 2012 Intel, Inc.
+ * Copyright (c) 2012, Intel Corporation.
* Use is subject to license terms.
*
* Author: Johann Lombardi <johann.lombardi@intel.com>
* a given ID.
*/
-#ifndef EXPORT_SYMTAB
-# define EXPORT_SYMTAB
-#endif
-
#define DEBUG_SUBSYSTEM S_LQUOTA
#include <obd_class.h>
}
static inline void qpi_putref(const struct lu_env *env,
- struct qmt_pool_info *pool)
+ struct qmt_pool_info *pool)
{
LASSERT(atomic_read(&pool->qpi_ref) > 0);
if (cfs_atomic_dec_and_test(&pool->qpi_ref))
struct dt_object *qmt_root)
{
struct qmt_thread_info *qti = qmt_info(env);
+ struct lquota_glb_rec *rec = &qti->qti_glb_rec;
struct qmt_pool_info *pool;
struct dt_device *dev = NULL;
+ dt_obj_version_t version;
cfs_list_t *pos;
int rc = 0, qtype;
ENTRY;
pool->qpi_glb_obj[qtype] = obj;
+ version = dt_version_get(env, obj);
+ /* set default grace time for newly created index */
+ if (version == 0) {
+ rec->qbr_hardlimit = 0;
+ rec->qbr_softlimit = 0;
+ rec->qbr_granted = 0;
+ rec->qbr_time = pool_type == LQUOTA_RES_MD ?
+ MAX_IQ_TIME : MAX_DQ_TIME;
+
+ rc = lquota_disk_write_glb(env, obj, 0, rec);
+ if (rc) {
+ CERROR("%s: failed to set default "
+ "grace time for %s type (%d)\n",
+ qmt->qmt_svname,
+ QTYPE_NAME(qtype), rc);
+ RETURN(rc);
+ }
+
+ rc = lquota_disk_update_ver(env, dev, obj, 1);
+ if (rc) {
+ CERROR("%s: failed to set initial "
+ "version for %s type (%d)\n",
+ qmt->qmt_svname,
+ QTYPE_NAME(qtype), rc);
+ RETURN(rc);
+ }
+ }
+
/* create quota entry site for this quota type */
pool->qpi_site[qtype] = lquota_site_alloc(env, pool,
true, qtype,
* entry since we keep a reference on ID 0 all the time */
lqe = pool->qpi_grace_lqe[qtype];
lqe_getref(lqe);
- GOTO(out, 0);
+ GOTO(out, lqe);
}
/* now that we have the pool, let's look-up the quota entry in the