# include <linux/init.h>
# include <linux/fs.h>
# include <linux/jbd.h>
-# include <linux/smp_lock.h>
# include <linux/buffer_head.h>
# include <linux/workqueue.h>
# include <linux/mount.h>
#ifdef __KERNEL__
static cfs_time_t last_print = 0;
-static cfs_spinlock_t last_print_lock = CFS_SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(last_print_lock);
static int filter_quota_setup(struct obd_device *obd)
{
for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
struct lustre_qunit_size *lqs = NULL;
+ /* check if quota is enabled */
+ if (!ll_sb_has_quota_active(obt->obt_sb, cnt))
+ continue;
+
lqs = quota_search_lqs(LQS_KEY(cnt, GET_OA_ID(cnt, oa)),
qctxt, 0);
if (IS_ERR(lqs)) {
QDATA_SET_BLK(&qdata[i]);
qdata[i].qd_count = 0;
+ /* check if quota is enabled */
+ if (!ll_sb_has_quota_active(qctxt->lqc_sb, i))
+ continue;
+
/* ignore root user */
if (qdata[i].qd_id == 0 && !QDATA_IS_GRP(&qdata[i]))
continue;
RETURN(0);
for (i = 0; i < MAXQUOTAS; i++) {
+ /* check if quota is enabled */
+ if (!ll_sb_has_quota_active(obd->u.obt.obt_qctxt.lqc_sb, i))
+ continue;
lqs = quota_search_lqs(LQS_KEY(i, id[i]),
&obd->u.obt.obt_qctxt, 0);
if (lqs && !IS_ERR(lqs)) {
while ((rc = quota_check_common(obd, id, pending, count, cycle, isblk,
inode, frags)) &
QUOTA_RET_ACQUOTA) {
-
- cfs_spin_lock(&qctxt->lqc_lock);
- if (!qctxt->lqc_import && oti) {
- cfs_spin_unlock(&qctxt->lqc_lock);
- LASSERT(oti->oti_thread);
- /* The recovery thread doesn't have watchdog
- * attached. LU-369 */
- if (oti->oti_thread->t_watchdog)
- lc_watchdog_disable(oti->oti_thread->\
- t_watchdog);
- CDEBUG(D_QUOTA, "sleep for quota master\n");
- l_wait_event(qctxt->lqc_wait_for_qmaster, check_qm(qctxt),
- &lwi);
- CDEBUG(D_QUOTA, "wake up when quota master is back\n");
- if (oti->oti_thread->t_watchdog)
- lc_watchdog_touch(oti->oti_thread->t_watchdog,
- CFS_GET_TIMEOUT(oti->oti_thread->t_svc));
+ struct ptlrpc_thread *thr = oti != NULL ?
+ oti->oti_thread : NULL;
+
+ cfs_spin_lock(&qctxt->lqc_lock);
+ if (!qctxt->lqc_import && oti != NULL) {
+ cfs_spin_unlock(&qctxt->lqc_lock);
+
+ LASSERT(thr != NULL);
+ /* The recovery thread doesn't have watchdog
+ * attached. LU-369 */
+ if (thr->t_watchdog != NULL)
+ lc_watchdog_disable(thr->t_watchdog);
+ CDEBUG(D_QUOTA, "sleep for quota master\n");
+ l_wait_event(qctxt->lqc_wait_for_qmaster,
+ check_qm(qctxt), &lwi);
+
+ CDEBUG(D_QUOTA, "wake up when quota master is back\n");
+ if (thr->t_watchdog != NULL) {
+ lc_watchdog_touch(thr->t_watchdog,
+ ptlrpc_server_get_timeout(thr->t_svcpt));
+ }
} else {
cfs_spin_unlock(&qctxt->lqc_lock);
}
cfs_waitq_t waitq;
struct l_wait_info lwi;
- if (oti && oti->oti_thread && oti->oti_thread->t_watchdog)
- lc_watchdog_touch(oti->oti_thread->t_watchdog,
- CFS_GET_TIMEOUT(oti->oti_thread->t_svc));
+ if (thr != NULL && thr->t_watchdog != NULL)
+ lc_watchdog_touch(thr->t_watchdog,
+ ptlrpc_server_get_timeout(thr->t_svcpt));
CDEBUG(D_QUOTA, "rc: %d, count_err: %d\n", rc,
count_err++);
cfs_proc_dir_entry_t *lquota_type_proc_dir = NULL;
-static int __init init_lustre_quota(void)
+int init_lustre_quota(void)
{
int rc = 0;
return 0;
}
-static void /*__exit*/ exit_lustre_quota(void)
+void exit_lustre_quota(void)
{
PORTAL_SYMBOL_UNREGISTER(filter_quota_interface);
PORTAL_SYMBOL_UNREGISTER(mds_quota_interface);
lprocfs_remove(&lquota_type_proc_dir);
}
-MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
-MODULE_DESCRIPTION("Lustre Quota");
-MODULE_LICENSE("GPL");
-
-cfs_module(lquota, "1.0.0", init_lustre_quota, exit_lustre_quota);
-
EXPORT_SYMBOL(mds_quota_interface);
EXPORT_SYMBOL(filter_quota_interface);
#endif /* __KERNEL */