LC_CONFIG_PINGER
LC_CONFIG_CHECKSUM
LC_CONFIG_LIBLUSTRE_RECOVERY
- LC_CONFIG_QUOTA
LC_CONFIG_HEALTH_CHECK_WRITE
LC_CONFIG_LRU_RESIZE
LC_CONFIG_ADAPTIVE_TIMEOUTS
+ LC_QUOTA_MODULE
LC_TASK_PPTR
# RHEL4 patches
#
# LC_CONFIG_QUOTA
#
-# whether to enable quota support
+# whether to enable quota support global control
#
AC_DEFUN([LC_CONFIG_QUOTA],
-[AC_ARG_ENABLE([quota],
+[AC_ARG_ENABLE([quota],
AC_HELP_STRING([--enable-quota],
[enable quota support]),
- [],[enable_quota='default'])
-if test x$linux25 != xyes; then
- enable_quota='no'
+ [],[enable_quota='yes'])
+])
+
+# whether to enable quota support(kernel modules)
+AC_DEFUN([LC_QUOTA_MODULE],
+[if test x$enable_quota != xno; then
+ LB_LINUX_CONFIG([QUOTA],[
+ enable_quota_module='yes'
+ AC_DEFINE(HAVE_QUOTA_SUPPORT, 1, [Enable quota support])
+ ],[
+ enable_quota_module='no'
+ AC_MSG_WARN([quota is not enabled because the kernel - lacks quota support])
+ ])
fi
-LB_LINUX_CONFIG([QUOTA],[
- if test x$enable_quota = xdefault; then
- enable_quota='yes'
- fi
-],[
- if test x$enable_quota = xdefault; then
- enable_quota='no'
- AC_MSG_WARN([quota is not enabled because the kernel lacks quota support])
- else
- if test x$enable_quota = xyes; then
- AC_MSG_ERROR([cannot enable quota because the kernel lacks quota support])
- fi
- fi
])
+
+#
+# LC_CONFIG_QUOTA_LIBLUSTRE
+#
+# whether to enable quota support(liblustre)
+#
+AC_DEFUN([LC_CONFIG_QUOTA_LIBLUSTRE],
+[enable_quota_liblustre='no'
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
])
+AC_DEFUN([LC_QUOTA],
+[#check global
+LC_CONFIG_QUOTA
+LC_CONFIG_QUOTA_LIBLUSTRE
+#check for utils
+AC_CHECK_HEADER(sys/quota.h,
+ [AC_DEFINE(HAVE_SYS_QUOTA_H, 1, [Define to 1 if you have <sys/quota.h>.])],
+ [AC_MSG_ERROR([don't find <sys/quota.h> in your system])])
+])
+
AC_DEFUN([LC_QUOTA_READ],
[AC_MSG_CHECKING([if kernel supports quota_read])
LB_LINUX_TRY_COMPILE([
AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
-AM_CONDITIONAL(QUOTA, test x$enable_quota = xyes)
+AM_CONDITIONAL(QUOTA, test x$enable_quota_module = xyes -o x$enable_quota_liblustre = xyes)
AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
return ldlm_namespace_cleanup;
else if (!strcmp(arg, "ldlm_replay_locks"))
return ldlm_replay_locks;
-#ifdef HAVE_QUOTA_SUPPORT
+#ifdef HAVE_QUOTA_LIBLUSTRE_SUPPORT
else if (!strcmp(arg, "osc_quota_interface"))
return &osc_quota_interface;
else if (!strcmp(arg, "mdc_quota_interface"))
return 0;
}
+#ifdef HAVE_QUOTA_SUPPORT
#define DQINFO_COPY(out, in) \
do { \
Q_COPY(out, in, dqi_bgrace); \
RETURN(rc);
}
-#ifdef HAVE_QUOTA_SUPPORT
static int fsfilt_ext3_quotainfo(struct lustre_quota_info *lqi, int type,
int cmd)
{
.fs_setup = fsfilt_ext3_setup,
.fs_send_bio = fsfilt_ext3_send_bio,
.fs_get_op_len = fsfilt_ext3_get_op_len,
- .fs_quotactl = fsfilt_ext3_quotactl,
- .fs_quotacheck = fsfilt_ext3_quotacheck,
#ifdef HAVE_DISK_INODE_VERSION
.fs_get_version = fsfilt_ext3_get_version,
.fs_set_version = fsfilt_ext3_set_version,
#endif
#ifdef HAVE_QUOTA_SUPPORT
+ .fs_quotactl = fsfilt_ext3_quotactl,
+ .fs_quotacheck = fsfilt_ext3_quotacheck,
.fs_quotainfo = fsfilt_ext3_quotainfo,
.fs_qids = fsfilt_ext3_qids,
.fs_dquot = fsfilt_ext3_dquot,
#ifndef _LUSTRE_QUOTA_FMT_H
#define _LUSTRE_QUOTA_FMT_H
+#ifdef HAVE_QUOTA_SUPPORT
+
#include <linux/types.h>
#include <linux/quota.h>
#define LUSTRE_OPQFILES_NAMES { { "lquota.user", "lquota.group" }, \
{ "lquota_v2.user", "lquota_v2.group" } }
#endif /* lustre_quota_fmt.h */
+#endif
RETURN(0);
}
+#ifdef HAVE_QUOTA_SUPPORT
static int mds_handle_quotacheck(struct ptlrpc_request *req)
{
struct obd_quotactl *oqctl;
*repoqc = *oqctl;
RETURN(0);
}
+#endif
static int mds_msg_check_version(struct lustre_msg *msg)
{
DEBUG_REQ(D_INODE, req, "set_info");
rc = mds_set_info_rpc(req->rq_export, req);
break;
-
+#ifdef HAVE_QUOTA_SUPPORT
case MDS_QUOTACHECK:
DEBUG_REQ(D_INODE, req, "quotacheck");
OBD_FAIL_RETURN(OBD_FAIL_MDS_QUOTACHECK_NET, 0);
OBD_FAIL_RETURN(OBD_FAIL_MDS_QUOTACTL_NET, 0);
rc = mds_handle_quotactl(req);
break;
-
+#endif
case OBD_PING:
DEBUG_REQ(D_INODE, req, "ping");
rc = target_handle_ping(req);
RETURN(rc);
}
+#ifdef HAVE_QUOTA_SUPPORT
static int ost_handle_quotactl(struct ptlrpc_request *req)
{
struct obd_quotactl *oqctl, *repoqc;
out:
RETURN(rc);
}
+#endif
static int ost_filter_recovery_request(struct ptlrpc_request *req,
struct obd_device *obd, int *process)
case OST_SYNC:
case OST_SET_INFO:
case OST_GET_INFO:
+#ifdef HAVE_QUOTA_SUPPORT
case OST_QUOTACHECK:
case OST_QUOTACTL:
case OST_QUOTA_ADJUST_QUNIT:
lustre_msg_get_version(msg),
LUSTRE_OST_VERSION);
break;
+#endif
case LDLM_ENQUEUE:
case LDLM_CONVERT:
case LDLM_CANCEL:
DEBUG_REQ(D_INODE, req, "get_info");
rc = ost_get_info(req->rq_export, req);
break;
+#ifdef HAVE_QUOTA_SUPPORT
case OST_QUOTACHECK:
CDEBUG(D_INODE, "quotacheck\n");
OBD_FAIL_RETURN(OBD_FAIL_OST_QUOTACHECK_NET, 0);
CDEBUG(D_INODE, "quota_adjust_qunit\n");
rc = ost_handle_quota_adjust_qunit(req);
break;
+#endif
case OBD_PING:
DEBUG_REQ(D_INODE, req, "ping");
rc = target_handle_ping(req);
#include <dirent.h>
#include <time.h>
#include <ctype.h>
+#ifdef HAVE_SYS_QUOTA_H
#include <sys/quota.h>
+#endif
#include <lnet/api-support.h>
#include <lnet/lnetctl.h>
static int lfs_df(int argc, char **argv);
static int lfs_check(int argc, char **argv);
static int lfs_catinfo(int argc, char **argv);
-#ifdef HAVE_QUOTA_SUPPORT
+#ifdef HAVE_SYS_QUOTA_H
static int lfs_quotachown(int argc, char **argv);
static int lfs_quotacheck(int argc, char **argv);
static int lfs_quotaon(int argc, char **argv);
"report filesystem disk space usage or inodes usage"
"of each MDS/OSD.\n"
"Usage: df [-i] [-h] [path]"},
-#ifdef HAVE_QUOTA_SUPPORT
+#ifdef HAVE_SYS_QUOTA_H
{"quotachown",lfs_quotachown, 0,
"Change files' owner or group on the specified filesystem.\n"
"usage: quotachown [-i] <filesystem>\n"
return res;
}
+#define USER 0
+#define GROUP 1
+
static int name2id(unsigned int *id, char *name, int type)
{
- if (type == USRQUOTA) {
+ if (type == USER) {
struct passwd *entry;
if (!(entry = getpwnam(name))) {
static int id2name(char **name, unsigned int id, int type)
{
- if (type == USRQUOTA) {
+ if (type == USER) {
struct passwd *entry;
if (!(entry = getpwuid(id))) {
new_fashion = 1;
param.gid = strtol(optarg, &endptr, 10);
if (optarg == endptr) {
- ret = name2id(¶m.gid, optarg, GRPQUOTA);
+ ret = name2id(¶m.gid, optarg, GROUP);
if (ret != 0) {
fprintf(stderr, "Group/GID: %s cannot "
"be found.\n", optarg);
new_fashion = 1;
param.uid = strtol(optarg, &endptr, 10);
if (optarg == endptr) {
- ret = name2id(¶m.uid, optarg, USRQUOTA);
+ ret = name2id(¶m.uid, optarg, USER);
if (ret != 0) {
fprintf(stderr, "User/UID: %s cannot "
"be found.\n", optarg);
return rc;
}
-#ifdef HAVE_QUOTA_SUPPORT
+#ifdef HAVE_SYS_QUOTA_H
static int lfs_quotachown(int argc, char **argv)
{
" be available in future releases!\n");
qctl.qc_type = !strcmp(argv[1], "-u") ? USRQUOTA : GRPQUOTA;
- rc = name2id(&qctl.qc_id, argv[2], qctl.qc_type);
+ rc = name2id(&qctl.qc_id, argv[2],
+ (qctl.qc_type == USRQUOTA) ? USER : GROUP);
if (rc) {
fprintf(stderr, "error: unknown id %s\n", optarg);
return CMD_HELP;
return CMD_HELP;
}
qctl.qc_type = (c == 'u') ? USRQUOTA : GRPQUOTA;
- rc = name2id(&qctl.qc_id, optarg, qctl.qc_type);
+ rc = name2id(&qctl.qc_id, optarg,
+ (qctl.qc_type == USRQUOTA) ? USER : GROUP);
if (rc) {
fprintf(stderr, "error: unknown id %s\n",
optarg);
qctl.qc_type = GRPQUOTA;
qctl.qc_id = getegid();
}
- rc = id2name(&name, qctl.qc_id, qctl.qc_type);
+ rc = id2name(&name, qctl.qc_id,
+ (qctl.qc_type == USRQUOTA) ? USER : GROUP);
if (rc)
name = "<unknown>";
} else if (qctl.qc_cmd == LUSTRE_Q_GETQUOTA) {
}
name = argv[optind++];
- rc = name2id(&qctl.qc_id, name, qctl.qc_type);
+ rc = name2id(&qctl.qc_id, name,
+ (qctl.qc_type == USRQUOTA) ? USER : GROUP);
if (rc) {
fprintf(stderr,"error: can't find id for name %s: %s\n",
name, strerror(errno));
return 0;
}
-#endif /* HAVE_QUOTA_SUPPORT */
+#endif /* HAVE_SYS_QUOTA_H! */
int main(int argc, char **argv)
{