])
])
+# 2.6.27 sles11 remove the bi_hw_segments
+AC_DEFUN([LC_BI_HW_SEGMENTS],
+[AC_MSG_CHECKING([struct bio has a bi_hw_segments field])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/bio.h>
+],[
+ struct bio io;
+ io.bi_hw_segments = 0;
+],[
+ AC_DEFINE(HAVE_BI_HW_SEGMENTS, 1,
+ [struct bio has a bi_hw_segments field])
+ AC_MSG_RESULT([yes])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+# 2.6.27 sles11 move the quotaio_v1.h to fs
+AC_DEFUN([LC_HAVE_QUOTAIO_V1_H],
+[LB_CHECK_FILE([$LINUX/include/linux/quotaio_v1.h],[
+ AC_DEFINE(HAVE_QUOTAIO_V1_H, 1,
+ [kernel has include/linux/quotaio_v1.h])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+# sles10 sp2 need 5 parameter for vfs_symlink
+AC_DEFUN([LC_VFS_SYMLINK_5ARGS],
+[AC_MSG_CHECKING([vfs_symlink need 5 parameter])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+],[
+ struct inode *dir = NULL;
+ struct dentry *dentry = NULL;
+ struct vfsmount *mnt = NULL;
+ const char * path = NULL;
+ vfs_symlink(dir, dentry, mnt, path, 0);
+],[
+ AC_DEFINE(HAVE_VFS_SYMLINK_5ARGS, 1,
+ [vfs_symlink need 5 parameteres])
+ AC_MSG_RESULT([yes])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+# 2.6.27 removed the read_inode from super_operations.
+AC_DEFUN([LC_READ_INODE_IN_SBOPS],
+[AC_MSG_CHECKING([super_operations has a read_inode field])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+],[
+ struct super_operations *sop;
+ sop->read_inode(NULL);
+],[
+ AC_DEFINE(HAVE_READ_INODE_IN_SBOPS, 1,
+ [super_operations has a read_inode])
+ AC_MSG_RESULT([yes])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+#
# Ensure stack size big than 8k in Lustre server
AC_DEFUN([LC_STACK_SIZE],
[AC_MSG_CHECKING([stack size big than 8k])
LC_FILE_REMOVE_SUID
LC_TRYLOCKPAGE
LC_RW_TREE_LOCK
+ LC_READ_INODE_IN_SBOPS
+
+ # 2.6.27.15-2 sles11
+ LC_BI_HW_SEGMENTS
+ LC_HAVE_QUOTAIO_V1_H
+ LC_VFS_SYMLINK_5ARGS
])
#
#define sysctl_vfs_cache_pressure 100
#endif
+#ifdef HAVE_SB_HAS_QUOTA_ACTIVE
+#define ll_sb_has_quota_active(sb, type) sb_has_quota_active(sb, type)
+#else
+#define ll_sb_has_quota_active(sb, type) sb_has_quota_enabled(sb, type)
+#endif
+
+#ifdef HAVE_SB_ANY_QUOTA_ACTIVE
+#define ll_sb_any_quota_active(sb) sb_any_quota_active(sb)
+#else
+#define ll_sb_any_quota_active(sb) sb_any_quota_enabled(sb)
+#endif
+
+static inline int
+ll_quota_on(struct super_block *sb, int off, int ver, char *name, int remount)
+{
+ if (sb->s_qcop->quota_on) {
+ return sb->s_qcop->quota_on(sb, off, ver, name
+#ifdef HAVE_QUOTA_ON_5ARGS
+ , remount
+#endif
+ );
+ }
+ else
+ return -ENOSYS;
+}
+
+static inline int ll_quota_off(struct super_block *sb, int off, int remount)
+{
+ if (sb->s_qcop->quota_off) {
+ return sb->s_qcop->quota_off(sb, off
+#ifdef HAVE_QUOTA_OFF_3ARGS
+ , remount
+#endif
+ );
+ }
+ else
+ return -ENOSYS;
+}
+
#endif /* __KERNEL__ */
#endif /* _COMPAT25_H */
};
#ifdef NEED_QUOTA_DEFS
-#ifndef QUOTABLOCK_BITS
-#define QUOTABLOCK_BITS 10
-#endif
-
-#ifndef QUOTABLOCK_SIZE
-#define QUOTABLOCK_SIZE (1 << QUOTABLOCK_BITS)
-#endif
-
-#ifndef toqb
-#define toqb(x) (((x) + QUOTABLOCK_SIZE - 1) >> QUOTABLOCK_BITS)
-#endif
#ifndef QIF_BLIMITS
#define QIF_BLIMITS 1
#define NR_DQHASH 45
#endif
+#ifndef QUOTABLOCK_BITS
+#define QUOTABLOCK_BITS 10
+#endif
+
+#ifndef QUOTABLOCK_SIZE
+#define QUOTABLOCK_SIZE (1 << QUOTABLOCK_BITS)
+#endif
+
+#ifndef toqb
+#define toqb(x) (((x) + QUOTABLOCK_SIZE - 1) >> QUOTABLOCK_BITS)
+#endif
+
#ifdef HAVE_QUOTA_SUPPORT
+#ifndef MAX_IQ_TIME
+#define MAX_IQ_TIME 604800 /* (7*24*60*60) 1 week */
+#endif
+
+#ifndef MAX_DQ_TIME
+#define MAX_DQ_TIME 604800 /* (7*24*60*60) 1 week */
+#endif
+
#ifdef __KERNEL__
#ifdef LPROCFS
struct list_head *list);
int lustre_quota_convert(struct lustre_quota_info *lqi, int type);
-#define LL_DQUOT_OFF(sb) DQUOT_OFF(sb)
+#ifdef HAVE_VFS_DQ_OFF
+#define LL_DQUOT_OFF(sb, remount) vfs_dq_off(sb, remount)
+#else
+#define LL_DQUOT_OFF(sb, remount) DQUOT_OFF(sb)
+#endif
typedef int (*dqacq_handler_t) (struct obd_device * obd, struct qunit_data * qd,
int opc);
#else
-#define LL_DQUOT_OFF(sb) do {} while(0)
+#define LL_DQUOT_OFF(sb, remount) do {} while(0)
struct lustre_quota_info {
};
#include <linux/version.h>
#include <linux/bitops.h>
#include <linux/quota.h>
-#include <linux/quotaio_v1.h>
-#include <linux/quotaio_v2.h>
+#ifdef HAVE_QUOTAIO_V1_H
+# include <linux/quotaio_v1.h>
+# include <linux/quotaio_v2.h>
+#else
+# include <quotaio_v1.h>
+# include <quotaio_v2.h>
+# include <quota_tree.h>
+# define V2_DQTREEOFF QT_TREEOFF
+#endif
#include <linux/parser.h>
#include <ext3/xattr.h>
/* We assume that there will be 1 bit set in s_dquot.flags for each
* quota file that is active. This is at least true for now.
*/
- needed += hweight32(sb_any_quota_enabled(sb)) *
+ needed += hweight32(ll_sb_any_quota_active(sb)) *
FSFILT_SINGLEDATA_TRANS_BLOCKS(sb);
#endif
lustre_quota_version_t qfmt = oqc->qc_id;
char *name[][MAXQUOTAS] = LUSTRE_OPQFILES_NAMES;
- if (!qcop->quota_on)
- GOTO(out, rc = -ENOSYS);
-
- rc = qcop->quota_on(sb, i, QFMT_VFS_V0,
- name[qfmt][i]);
+ rc = ll_quota_on(sb, i, QFMT_VFS_V0,
+ name[qfmt][i], 0);
#ifdef HAVE_QUOTA64
if (rc == -ENOENT || rc == -EINVAL) {
/* see bug 13904 */
rc = lustre_slave_quota_convert(qfmt, i);
if (!rc)
- rc = qcop->quota_on(sb, i,
- QFMT_VFS_V0,
- name[qfmt][i]);
+ rc = ll_quota_on(sb, i,
+ QFMT_VFS_V0,
+ name[qfmt][i], 0);
else if (rc == -ESTALE)
rc = -ENOENT;
}
#endif
- } else if (oqc->qc_cmd == Q_QUOTAOFF) {
- if (!qcop->quota_off)
- GOTO(out, rc = -ENOSYS);
- rc = qcop->quota_off(sb, i);
- }
+ } else if (oqc->qc_cmd == Q_QUOTAOFF)
+ rc = ll_quota_off(sb, i, 0);
if (rc == -EBUSY)
error = rc;
struct inode *inode = NULL;
if (ext3_test_bit(index, bitmap_bh->b_data))
+#ifdef HAVE_READ_INODE_IN_SBOPS
inode = iget(sb, ino);
-
+#else
+ inode = ext3_iget(sb, ino);
+#endif
return inode;
}
static int v2_write_dqheader(struct file *f, int type)
{
static const __u32 quota_magics[] = V2_INITQMAGICS;
-#ifdef HAVE_QUOTA64
- static const __u32 quota_versions[] = V2_INITQVERSIONS_R0;
-#else
- static const __u32 quota_versions[] = V2_INITQVERSIONS;
-#endif
+ static const __u32 quota_versions[] = LUSTRE_INITQVERSIONS_V1;
struct v2_disk_dqheader dqhead;
loff_t offset = 0;
static int v3_write_dqheader(struct file *f, int type)
{
static const __u32 quota_magics[] = V2_INITQMAGICS;
- static const __u32 quota_versions[] = V2_INITQVERSIONS_R1;
+ static const __u32 quota_versions[] = LUSTRE_INITQVERSIONS_V2;
struct v2_disk_dqheader dqhead;
loff_t offset = 0;
#include <linux/init.h>
#include <linux/module.h>
#include <linux/slab.h>
-#include <linux/quotaio_v1.h>
+#ifdef HAVE_QUOTAIO_V1_H
+# include <linux/quotaio_v1.h>
+#endif
#include <asm/byteorder.h>
#include <asm/uaccess.h>
#ifdef HAVE_QUOTA_SUPPORT
static const uint lustre_initqversions[][MAXQUOTAS] = {
- [LUSTRE_QUOTA_V1] = LUSTRE_INITQVERSIONS,
+ [LUSTRE_QUOTA_V1] = LUSTRE_INITQVERSIONS_V1,
[LUSTRE_QUOTA_V2] = LUSTRE_INITQVERSIONS_V2
};
}
/* for the verson 1 of lustre_disk_dqblk*/
-#define LUSTRE_INITQVERSIONS {\
+#define LUSTRE_INITQVERSIONS_V1 {\
0, /* USRQUOTA */\
0 /* GRPQUOTA */\
}
#include <linux/init.h>
#include <linux/module.h>
#include <linux/slab.h>
-#include <linux/quotaio_v1.h>
+#ifdef HAVE_QUOTAIO_V1_H
+# include <linux/quotaio_v1.h>
+#endif
#include <asm/byteorder.h>
#include <asm/uaccess.h>
{
struct lustre_disk_dqheader dqhead;
static const uint quota_magics[] = LUSTRE_INITQMAGICS;
- static const uint quota_versions[] = LUSTRE_INITQVERSIONS;
+ static const uint quota_versions[] = LUSTRE_INITQVERSIONS_V1;
struct file *fp;
struct inode *parent_inode = tgt->obd_lvfs_ctxt.pwd->d_inode;
size_t size;
OBD_SLAB_FREE_PTR(saved, obd_lvfs_ctxt_cache);
shrink_dcache_parent(mds->mds_fid_de);
dput(mds->mds_fid_de);
- LL_DQUOT_OFF(obd->u.obt.obt_sb);
+ LL_DQUOT_OFF(obd->u.obt.obt_sb, 0);
return rc;
}
filter_post(obd);
- LL_DQUOT_OFF(obd->u.obt.obt_sb);
+ LL_DQUOT_OFF(obd->u.obt.obt_sb, 0);
shrink_dcache_sb(obd->u.obt.obt_sb);
server_put_mount(obd->obd_name, filter->fo_vfsmnt);
int ret = 0;
ENTRY;
- if (!sb_any_quota_enabled(sb))
+ if (!ll_sb_any_quota_active(sb))
RETURN(0);
spin_lock(&qctxt->lqc_lock);
int ret = QUOTA_RET_OK;
ENTRY;
- if (!sb_any_quota_enabled(sb))
+ if (!ll_sb_any_quota_active(sb))
RETURN(QUOTA_RET_NOQUOTA);
/* ignore root user */
int ret;
LOCK_DQONOFF_MUTEX(dqopt);
- if (!sb_has_quota_enabled(qctxt->lqc_sb, type)) {
+ if (!ll_sb_has_quota_active(qctxt->lqc_sb, type)) {
UNLOCK_DQONOFF_MUTEX(dqopt);
break;
}
int rc;
ENTRY;
- if (!sb_any_quota_enabled(qctxt->lqc_sb))
+ if (!ll_sb_any_quota_active(qctxt->lqc_sb))
goto exit;
data.obd = obd;
{
ENTRY;
- if (!sb_any_quota_enabled(obd->u.obt.obt_sb))
+ if (!ll_sb_any_quota_active(obd->u.obt.obt_sb))
RETURN(0);
if (ignore) {
struct obd_quotactl *oqctl;
ENTRY;
- if (!sb_any_quota_enabled(obt->obt_sb))
+ if (!ll_sb_any_quota_active(obt->obt_sb))
RETURN(0);
OBD_ALLOC_PTR(oqctl);
__u32 id[MAXQUOTAS] = { uid, gid };
int i, q_set = 0;
- if (!sb_any_quota_enabled(obd->u.obt.obt_qctxt.lqc_sb))
+ if (!ll_sb_any_quota_active(obd->u.obt.obt_qctxt.lqc_sb))
RETURN(0);
for (i = 0; i < MAXQUOTAS; i++) {
CDEBUG(D_QUOTA, "commit pending quota for %s\n", obd->obd_name);
CLASSERT(MAXQUOTAS < 4);
- if (!sb_any_quota_enabled(qctxt->lqc_sb))
+ if (!ll_sb_any_quota_active(qctxt->lqc_sb))
RETURN(0);
do_gettimeofday(&work_start);
#include <lustre/lustre_idl.h>
#include <lustre/liblustreapi.h>
#include <lustre/lustre_user.h>
+#include <lustre_quota.h>
#include "parser.h"
#include "obdctl.h"