subdir-m += osc
subdir-m += obdecho
subdir-m += mgc
+subdir-m += quota
@SERVER_TRUE@subdir-m += mds obdfilter ost mgs
@CLIENT_TRUE@subdir-m += mdc llite
-@QUOTA_TRUE@subdir-m += quota
@INCLUDE_RULES@
if test x$enable_quota != xno; then
AC_MSG_CHECKING([if compile liblustre with quota])
enable_quota_liblustre='yes'
- AC_DEFINE(HAVE_QUOTA_SUPPORT, 1, [Enable quota support])
AC_DEFINE(HAVE_QUOTA_LIBLUSTRE_SUPPORT, 1, [Enable liblustre quota support])
AC_MSG_RESULT([yes])
fi
int target_pack_pool_reply(struct ptlrpc_request *req);
void target_committed_to_req(struct ptlrpc_request *req);
-#ifdef HAVE_QUOTA_SUPPORT
/* quotacheck callback, dqacq/dqrel callback handler */
int target_handle_qc_callback(struct ptlrpc_request *req);
+#ifdef HAVE_QUOTA_SUPPORT
int target_handle_dqacq_callback(struct ptlrpc_request *req);
#else
#define target_handle_dqacq_callback(req) ldlm_callback_reply(req, -ENOTSUPP)
-#define target_handle_qc_callback(req) (0)
#endif
void target_cancel_recovery_timer(struct obd_device *obd);
extern quota_interface_t osc_quota_interface;
extern quota_interface_t mdc_quota_interface;
extern quota_interface_t lov_quota_interface;
+
+#ifndef MAXQUOTAS
+#define MAXQUOTAS 2
+#endif
+
+#ifndef USRQUOTA
+#define USRQUOTA 0
+#endif
+
+#ifndef GRPQUOTA
+#define GRPQUOTA 1
+#endif
+
#endif
#define LUSTRE_ADMIN_QUOTAFILES_V1 {\
return rc1 ?: rc2;
}
-#ifdef HAVE_QUOTA_SUPPORT
static inline int obd_quotacheck(struct obd_export *exp,
struct obd_quotactl *oqctl)
{
struct quota_adjust_qunit *oqaq,
struct lustre_quota_ctxt *qctxt)
{
-#ifdef LPROCFS
+#if defined(LPROCFS) && defined(HAVE_QUOTA_SUPPORT)
struct timeval work_start;
struct timeval work_end;
long timediff;
int rc;
ENTRY;
-#ifdef LPROCFS
+#if defined(LPROCFS) && defined(HAVE_QUOTA_SUPPORT)
if (qctxt)
do_gettimeofday(&work_start);
#endif
rc = OBP(exp->exp_obd, quota_adjust_qunit)(exp, oqaq, qctxt);
-#ifdef LPROCFS
+#if defined(LPROCFS) && defined(HAVE_QUOTA_SUPPORT)
if (qctxt) {
do_gettimeofday(&work_end);
timediff = cfs_timeval_sub(&work_end, &work_start, NULL);
#endif
RETURN(rc);
}
-#endif
static inline int obd_health_check(struct obd_device *obd)
{
EXPORT_SYMBOL(target_committed_to_req);
-#ifdef HAVE_QUOTA_SUPPORT
int target_handle_qc_callback(struct ptlrpc_request *req)
{
struct obd_quotactl *oqctl;
return 0;
}
+#ifdef HAVE_QUOTA_SUPPORT
int target_handle_dqacq_callback(struct ptlrpc_request *req)
{
#ifdef __KERNEL__
obd_ioctl_freedata(buf, len);
RETURN(rc);
}
-#ifdef HAVE_QUOTA_SUPPORT
case OBD_IOC_QUOTACHECK: {
struct obd_quotactl *oqctl;
int rc, error = 0;
OBD_FREE_PTR(oqctl);
RETURN(rc);
}
-#endif /* HAVE_QUOTA_SUPPORT */
case OBD_IOC_GETNAME_OLD:
case OBD_IOC_GETNAME: {
struct obd_device *obd = class_exp2obd(sbi->ll_osc_exp);
static int fsfilt_ext3_setup(struct super_block *sb)
{
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,6)) && defined(HAVE_QUOTA_SUPPORT)
struct ext3_sb_info *sbi = EXT3_SB(sb);
+#endif
#if 0
sbi->dx_lock = fsfilt_ext3_dx_lock;
sbi->dx_unlock = fsfilt_ext3_dx_unlock;
* from linux/fs/quota_v2.c
*/
-
#ifndef EXPORT_SYMTAB
# define EXPORT_SYMTAB
#endif
#include <obd_support.h>
#include "lustre_quota_fmt.h"
+#ifdef HAVE_QUOTA_SUPPORT
+
static const uint lustre_initqversions[][MAXQUOTAS] = {
[LUSTRE_QUOTA_V1] = LUSTRE_INITQVERSIONS,
[LUSTRE_QUOTA_V2] = LUSTRE_INITQVERSIONS_V2
EXPORT_SYMBOL(lustre_commit_dquot);
EXPORT_SYMBOL(lustre_init_quota_info);
EXPORT_SYMBOL(lustre_get_qids);
+#endif
#include <obd_support.h>
#include "lustre_quota_fmt.h"
+#ifdef HAVE_QUOTA_SUPPORT
+
static int admin_convert_dqinfo(struct file *fp_v1, struct file *fp_v2,
struct lustre_quota_info *lqi, int type)
{
return rc;
}
EXPORT_SYMBOL(lustre_slave_quota_convert);
-#endif
+#endif /* HAVE_QUOTA64 */
+#endif /* HAVE_QUOTA_SUPPORT */
#include "lustre_quota_fmt.h"
+#ifdef HAVE_QUOTA_SUPPORT
+
char *test_quotafile[2] = { "usrquota_test", "grpquota_test" };
static int quotfmt_initialize(struct lustre_quota_info *lqi,
module_init(quotfmt_test_init);
module_exit(quotfmt_test_exit);
+
+#endif /* HAVE_QUOTA_SUPPORT */
case OBD_NOTIFY_CONFIG:
mds_allow_cli(obd, (unsigned long)data);
+#ifdef HAVE_QUOTA_SUPPORT
/* quota_type has been processed, we can now handle
* incoming quota requests */
obd->u.obt.obt_qctxt.lqc_setup = 1;
+#endif
default:
RETURN(0);
}
RETURN(-EBUSY);
/* check if the file's owner/group is over quota */
-#ifdef HAVE_QUOTA_SUPPORT
if ((cmd & OBD_BRW_WRITE) && !(cmd & OBD_BRW_NOQUOTA)){
struct obd_async_page_ops *ops;
struct obdo *oa;
if (rc)
RETURN(rc);
}
-#endif
if (loi == NULL)
loi = lsm->lsm_oinfo[0];
case OST_QUOTACHECK:
case OST_QUOTACTL:
case OST_QUOTA_ADJUST_QUNIT:
+#endif
rc = lustre_msg_check_version(msg, LUSTRE_OST_VERSION);
if (rc)
CERROR("bad opc %u version %08x, expecting %08x\n",
lustre_msg_get_version(msg),
LUSTRE_OST_VERSION);
break;
-#endif
case LDLM_ENQUEUE:
case LDLM_CONVERT:
case LDLM_CANCEL:
#include "quota_internal.h"
+#ifdef HAVE_QUOTA_SUPPORT
+
#ifdef LPROCFS
int lprocfs_quota_rd_bunit(char *page, char **start, off_t off, int count,
int *eof, void *data)
}
#endif /* LPROCFS */
+#endif
#include <class_hash.h>
#include "quota_internal.h"
+#ifdef HAVE_QUOTA_SUPPORT
+
#ifdef __KERNEL__
/* this function is charge of recording lqs_ino_rec and
* lqs_blk_rec. when a lquota slave checks a quota
RETURN(rc);
}
#endif /* __KERNEL__ */
+#endif
int client_quota_adjust_qunit(struct obd_export *exp,
struct quota_adjust_qunit *oqaq,
* This file is part of Lustre, http://www.lustre.org/
* Lustre is a trademark of Sun Microsystems, Inc.
*/
+
+
#ifndef EXPORT_SYMTAB
# define EXPORT_SYMTAB
#endif
#include <lustre_quota.h>
#include "quota_internal.h"
+#ifdef HAVE_QUOTA_SUPPORT
#ifdef __KERNEL__
static int target_quotacheck_callback(struct obd_export *exp,
struct obd_quotactl *oqctl)
}
#endif /* __KERNEL__ */
+#endif /* HAVE_QUOTA_SUPPORT */
int client_quota_check(struct obd_export *exp, struct obd_quotactl *oqctl)
{
#include <lprocfs_status.h>
#include "quota_internal.h"
+#ifdef HAVE_QUOTA_SUPPORT
+
static lustre_hash_ops_t lqs_hash_ops;
unsigned long default_bunit_sz = 128 * 1024 * 1024; /* 128M bytes */
EXIT;
}
+
/*
* lqs<->qctxt hash operations
*/
.lh_put = lqs_put,
.lh_exit = lqs_exit
};
+#endif /* HAVE_QUOTA_SUPPORT */
#include <lustre_quota.h>
#include "quota_internal.h"
+#ifdef HAVE_QUOTA_SUPPORT
#ifdef __KERNEL__
int mds_quota_ctl(struct obd_export *exp, struct obd_quotactl *oqctl)
{
RETURN(rc);
}
#endif /* __KERNEL__ */
+#endif
int client_quota_ctl(struct obd_export *exp, struct obd_quotactl *oqctl)
{
int i, rc = 0;
ENTRY;
- if (oqctl->qc_cmd != Q_QUOTAON && oqctl->qc_cmd != Q_QUOTAOFF &&
- oqctl->qc_cmd != Q_GETOQUOTA && oqctl->qc_cmd != Q_INITQUOTA &&
- oqctl->qc_cmd != Q_SETQUOTA && oqctl->qc_cmd != Q_FINVALIDATE) {
+ if (oqctl->qc_cmd != LUSTRE_Q_QUOTAON &&
+ oqctl->qc_cmd != LUSTRE_Q_QUOTAOFF &&
+ oqctl->qc_cmd != Q_GETOQUOTA &&
+ oqctl->qc_cmd != Q_INITQUOTA &&
+ oqctl->qc_cmd != LUSTRE_Q_SETQUOTA &&
+ oqctl->qc_cmd != Q_FINVALIDATE) {
CERROR("bad quota opc %x for lov obd", oqctl->qc_cmd);
RETURN(-EFAULT);
}
#ifdef __KERNEL__
+#ifdef HAVE_QUOTA_SUPPORT
+
static cfs_time_t last_print = 0;
static spinlock_t last_print_lock = SPIN_LOCK_UNLOCKED;
{
return quota_pending_commit(obd, uid, gid, inodes, 0);
}
+#endif /* HAVE_QUOTA_SUPPORT */
#endif /* __KERNEL__ */
struct osc_quota_info {
}
#ifdef __KERNEL__
+#ifdef HAVE_QUOTA_SUPPORT
quota_interface_t mds_quota_interface = {
.quota_init = mds_quota_init,
.quota_exit = mds_quota_exit,
.quota_adjust_qunit = filter_quota_adjust_qunit,
.quota_pending_commit = filter_quota_pending_commit,
};
+#endif
#endif /* __KERNEL__ */
quota_interface_t mdc_quota_interface = {
static int __init init_lustre_quota(void)
{
+#ifdef HAVE_QUOTA_SUPPORT
int rc = 0;
lquota_type_proc_dir = lprocfs_register(OBD_LQUOTA_DEVICENAME,
rc = qunit_cache_init();
if (rc)
return rc;
+
PORTAL_SYMBOL_REGISTER(filter_quota_interface);
PORTAL_SYMBOL_REGISTER(mds_quota_interface);
+#endif
PORTAL_SYMBOL_REGISTER(mdc_quota_interface);
PORTAL_SYMBOL_REGISTER(osc_quota_interface);
PORTAL_SYMBOL_REGISTER(lov_quota_interface);
static void /*__exit*/ exit_lustre_quota(void)
{
- PORTAL_SYMBOL_UNREGISTER(filter_quota_interface);
- PORTAL_SYMBOL_UNREGISTER(mds_quota_interface);
PORTAL_SYMBOL_UNREGISTER(mdc_quota_interface);
PORTAL_SYMBOL_UNREGISTER(osc_quota_interface);
PORTAL_SYMBOL_UNREGISTER(lov_quota_interface);
+#ifdef HAVE_QUOTA_SUPPORT
+ PORTAL_SYMBOL_UNREGISTER(filter_quota_interface);
+ PORTAL_SYMBOL_UNREGISTER(mds_quota_interface);
qunit_cache_cleanup();
if (lquota_type_proc_dir)
lprocfs_remove(&lquota_type_proc_dir);
+#endif
}
MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
cfs_module(lquota, "1.0.0", init_lustre_quota, exit_lustre_quota);
+#ifdef HAVE_QUOTA_SUPPORT
EXPORT_SYMBOL(mds_quota_interface);
EXPORT_SYMBOL(filter_quota_interface);
+#endif
EXPORT_SYMBOL(mdc_quota_interface);
EXPORT_SYMBOL(osc_quota_interface);
EXPORT_SYMBOL(lov_quota_interface);
#include <lustre_quota.h>
+#ifdef HAVE_QUOTA_SUPPORT
+
/* QUSG covnert bytes to blocks when counting block quota */
#define QUSG(count, isblk) (isblk ? toqb(count) : count)
/* quota_ctl.c */
int mds_quota_ctl(struct obd_export *exp, struct obd_quotactl *oqctl);
int filter_quota_ctl(struct obd_export *exp, struct obd_quotactl *oqctl);
-int client_quota_ctl(struct obd_export *exp, struct obd_quotactl *oqctl);
-int lov_quota_ctl(struct obd_export *exp, struct obd_quotactl *oqctl);
/* quota_chk.c */
int target_quota_check(struct obd_export *exp, struct obd_quotactl *oqctl);
-int client_quota_check(struct obd_export *exp, struct obd_quotactl *oqctl);
-int lov_quota_check(struct obd_export *exp, struct obd_quotactl *oqctl);
-int client_quota_poll_check(struct obd_export *exp, struct if_quotacheck *qchk);
#ifdef LPROCFS
void lprocfs_quotactl_test_init_vars(struct lprocfs_static_vars *lvars);
}
#endif
-/* quota_adjust_qunit.c */
-int client_quota_adjust_qunit(struct obd_export *exp,
- struct quota_adjust_qunit *oqaq,
- struct lustre_quota_ctxt *qctxt);
-int lov_quota_adjust_qunit(struct obd_export *exp,
- 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);
void qdata_to_oqaq(struct qunit_data *qdata,
#endif
+int client_quota_adjust_qunit(struct obd_export *exp,
+ struct quota_adjust_qunit *oqaq,
+ struct lustre_quota_ctxt *qctxt);
+int lov_quota_adjust_qunit(struct obd_export *exp,
+ struct quota_adjust_qunit *oqaq,
+ struct lustre_quota_ctxt *qctxt);
+int client_quota_ctl(struct obd_export *exp, struct obd_quotactl *oqctl);
+int lov_quota_ctl(struct obd_export *exp, struct obd_quotactl *oqctl);
+int client_quota_check(struct obd_export *exp, struct obd_quotactl *oqctl);
+int lov_quota_check(struct obd_export *exp, struct obd_quotactl *oqctl);
+int client_quota_poll_check(struct obd_export *exp, struct if_quotacheck *qchk);
+#endif
#include "quota_internal.h"
+#ifdef HAVE_QUOTA_SUPPORT
+
/* 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;
wait_for_completion(&data.comp);
RETURN(rc);
}
+
+#endif /* HAVE_QUOTA_SUPPORT */