fi
])
-AC_DEFUN([LC_QUOTA_READ],
-[AC_MSG_CHECKING([if kernel supports quota_read])
-LB_LINUX_TRY_COMPILE([
- #include <linux/fs.h>
-],[
- struct super_operations sp;
- void *i = (void *)sp.quota_read;
-],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(KERNEL_SUPPORTS_QUOTA_READ, 1, [quota_read found])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-#
-# LC_COOKIE_FOLLOW_LINK
-#
-# kernel 2.6.13+ ->follow_link returns a cookie
-#
-AC_DEFUN([LC_COOKIE_FOLLOW_LINK],
-[AC_MSG_CHECKING([if inode_operations->follow_link returns a cookie])
-LB_LINUX_TRY_COMPILE([
- #include <linux/fs.h>
- #include <linux/namei.h>
-],[
- struct dentry *dentry = NULL;
- struct nameidata nd;
-
- dentry->d_inode->i_op->put_link(dentry, &nd, NULL);
-],[
- AC_DEFINE(HAVE_COOKIE_FOLLOW_LINK, 1, [inode_operations->follow_link returns a cookie])
- AC_MSG_RESULT([yes])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-#
-# LC_FUNC_RCU
-#
-# kernels prior than 2.6.0(?) have no RCU supported; in kernel 2.6.5(SUSE),
-# call_rcu takes three parameters.
-#
-AC_DEFUN([LC_FUNC_RCU],
-[AC_MSG_CHECKING([if kernel have RCU supported])
-LB_LINUX_TRY_COMPILE([
- #include <linux/rcupdate.h>
-],[],[
- AC_DEFINE(HAVE_RCU, 1, [have RCU defined])
- AC_MSG_RESULT([yes])
-
- AC_MSG_CHECKING([if call_rcu takes three parameters])
- LB_LINUX_TRY_COMPILE([
- #include <linux/rcupdate.h>
- ],[
- struct rcu_head rh;
- call_rcu(&rh, (void (*)(struct rcu_head *))1, NULL);
- ],[
- AC_DEFINE(HAVE_CALL_RCU_PARAM, 1, [call_rcu takes three parameters])
- AC_MSG_RESULT([yes])
- ],[
- AC_MSG_RESULT([no])
- ])
-
-],[
- AC_MSG_RESULT([no])
-])
-])
-
AC_DEFUN([LC_PERCPU_COUNTER],
[AC_MSG_CHECKING([if have struct percpu_counter defined])
LB_LINUX_TRY_COMPILE([
LC_CAPA_CRYPTO
LC_CONFIG_RMTCLIENT
LC_CONFIG_GSS
- LC_QUOTA_READ
- LC_COOKIE_FOLLOW_LINK
- LC_FUNC_RCU
LC_PERCPU_COUNTER
LC_TASK_CLENV_STORE
#include <libcfs/list.h>
#include <libcfs/libcfs.h>
+#define call_rcu(rcu, cb) (cb)(rcu)
+
#endif
#include <linux/spinlock.h>
#include <linux/types.h>
-# ifdef HAVE_RCU
-# include <linux/rcupdate.h> /* for rcu_head{} */
+#include <linux/rcupdate.h> /* for rcu_head{} */
typedef struct rcu_head cfs_rcu_head_t;
-# endif
#endif /* ifdef __KERNEL__ */
#include <libcfs/libcfs.h>
-#if !defined(HAVE_RCU) || !defined(__KERNEL__)
+#ifndef __KERNEL__
typedef struct {
- int foo;
+ int foo;
} cfs_rcu_head_t;
#endif
} while(0)
-#ifdef HAVE_RCU
-# ifdef HAVE_CALL_RCU_PARAM
-# define my_call_rcu(rcu, cb) call_rcu(rcu, cb, rcu)
-# else
-# define my_call_rcu(rcu, cb) call_rcu(rcu, cb)
-# endif
-#else
-# define my_call_rcu(rcu, cb) (cb)(rcu)
-#endif
-
#define OBD_FREE_RCU(ptr, size, handle) \
do { \
struct portals_handle *__h = (handle); \
LASSERT(handle != NULL); \
__h->h_cookie = (unsigned long)(ptr); \
__h->h_size = (size); \
- my_call_rcu(&__h->h_rcu, class_handle_free_cb); \
+ call_rcu(&__h->h_rcu, class_handle_free_cb); \
POISON_PTR(ptr); \
} while(0)
RETURN(rc);
}
-#ifdef HAVE_COOKIE_FOLLOW_LINK
-# define LL_FOLLOW_LINK_RETURN_TYPE void *
-#else
-# define LL_FOLLOW_LINK_RETURN_TYPE int
-#endif
-
-static LL_FOLLOW_LINK_RETURN_TYPE ll_follow_link(struct dentry *dentry,
- struct nameidata *nd)
+static void *ll_follow_link(struct dentry *dentry, struct nameidata *nd)
{
- struct inode *inode = dentry->d_inode;
- struct ptlrpc_request *request = NULL;
- int rc;
- char *symname;
- ENTRY;
+ struct inode *inode = dentry->d_inode;
+ struct ptlrpc_request *request = NULL;
+ int rc;
+ char *symname;
+ ENTRY;
CDEBUG(D_VFSTRACE, "VFS Op\n");
/* Limit the recursive symlink depth to 5 instead of default
GOTO(out, rc);
}
-#ifdef HAVE_COOKIE_FOLLOW_LINK
- nd_set_link(nd, symname);
- /* @symname may contain a pointer to the request message buffer,
- we delay request releasing until ll_put_link then. */
- RETURN(request);
-#else
- if (lli->lli_symlink_name == NULL) {
- /* falling back to recursive follow link if the request
- * needs to be cleaned up still. */
- rc = vfs_follow_link(nd, symname);
- GOTO(out, rc);
- }
- nd_set_link(nd, symname);
- RETURN(0);
-#endif
+ nd_set_link(nd, symname);
+ /* symname may contain a pointer to the request message buffer,
+ * we delay request releasing until ll_put_link then.
+ */
+ RETURN(request);
out:
- ptlrpc_req_finished(request);
-#ifdef HAVE_COOKIE_FOLLOW_LINK
- RETURN(ERR_PTR(rc));
-#else
- RETURN(rc);
-#endif
+ ptlrpc_req_finished(request);
+ RETURN(ERR_PTR(rc));
}
-#ifdef HAVE_COOKIE_FOLLOW_LINK
static void ll_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie)
{
- ptlrpc_req_finished(cookie);
+ ptlrpc_req_finished(cookie);
}
-#endif
struct inode_operations ll_fast_symlink_inode_operations = {
- .readlink = ll_readlink,
- .setattr = ll_setattr,
- .follow_link = ll_follow_link,
-#ifdef HAVE_COOKIE_FOLLOW_LINK
- .put_link = ll_put_link,
-#endif
- .getattr = ll_getattr,
- .permission = ll_inode_permission,
- .setxattr = ll_setxattr,
- .getxattr = ll_getxattr,
- .listxattr = ll_listxattr,
- .removexattr = ll_removexattr,
+ .readlink = ll_readlink,
+ .setattr = ll_setattr,
+ .follow_link = ll_follow_link,
+ .put_link = ll_put_link,
+ .getattr = ll_getattr,
+ .permission = ll_inode_permission,
+ .setxattr = ll_setxattr,
+ .getxattr = ll_getxattr,
+ .listxattr = ll_listxattr,
+ .removexattr = ll_removexattr,
};
continue;
- LASSERT(sb_dqopt(sb)->files[i] != NULL);
- CFS_INIT_LIST_HEAD(&id_list);
-#ifndef KERNEL_SUPPORTS_QUOTA_READ
- rc = lustre_get_qids(sb_dqopt(sb)->files[i], NULL, i, &id_list);
-#else
- rc = lustre_get_qids(NULL, sb_dqopt(sb)->files[i], i, &id_list);
-#endif
- if (rc)
- CERROR("read old limits failed. (rc:%d)\n", rc);
+ LASSERT(sb_dqopt(sb)->files[i] != NULL);
+ CFS_INIT_LIST_HEAD(&id_list);
+ rc = lustre_get_qids(NULL, sb_dqopt(sb)->files[i], i, &id_list);
+ if (rc)
+ CERROR("read old limits failed. (rc:%d)\n", rc);
cfs_list_for_each_entry_safe(dqid, tmp, &id_list, di_link) {
cfs_list_del_init(&dqid->di_link);
RETURN(rc);
}
-static int quotfmt_test_5(struct lustre_quota_info *lqi)
-{
-#ifndef KERNEL_SUPPORTS_QUOTA_READ
- int i, rc = 0;
-
- for (i = USRQUOTA; i < MAXQUOTAS && !rc; i++) {
- cfs_list_t list;
- struct dquot_id *dqid, *tmp;
-
- CFS_INIT_LIST_HEAD(&list);
- rc = lustre_get_qids(lqi->qi_files[i], NULL, i, &list);
- if (rc) {
- CERROR("%s get all %ss (rc:%d):\n",
- rc ? "error" : "success",
- i == USRQUOTA ? "uid" : "gid", rc);
- }
- cfs_list_for_each_entry_safe(dqid, tmp, &list, di_link) {
- cfs_list_del_init(&dqid->di_link);
- if (rc == 0)
- CDEBUG(D_INFO, "%d ", dqid->di_id);
- kfree(dqid);
- }
- CDEBUG(D_INFO, "\n");
- }
- return rc;
-#else
- CWARN("kernel supports quota_read OR kernel version >= 2.6.12, test skipped\n");
- return 0;
-#endif
-}
-
static int quotfmt_run_tests(struct obd_device *obd, struct obd_device *tgt)
{
struct lvfs_run_ctxt saved;
GOTO(out, rc);
}
- CWARN("=== test 5: walk through quota file to get all ids\n");
- rc = quotfmt_test_5(lqi);
- if (rc) {
- CERROR("walk through quota file failed\n");
- GOTO(out, rc);
- }
-
- out:
+out:
CWARN("=== Finalize quotafile test\n");
rc = quotfmt_finalize(lqi, tgt, &saved);
OBD_FREE(lqi, sizeof(*lqi));
#include <lustre_handles.h>
#include <lustre_lib.h>
-#if !defined(HAVE_RCU) || !defined(__KERNEL__)
+#ifndef __KERNEL__
# define list_add_rcu cfs_list_add
# define list_del_rcu cfs_list_del
# define list_for_each_rcu cfs_list_for_each
# define list_for_each_entry_rcu cfs_list_for_each_entry
# define rcu_read_lock() cfs_spin_lock(&bucket->lock)
# define rcu_read_unlock() cfs_spin_unlock(&bucket->lock)
-#endif /* ifndef HAVE_RCU */
+#endif /* !__KERNEL__ */
static __u64 handle_base;
#define HANDLE_INCR 7
break;
}
- LASSERT(dqopt->files[type] != NULL);
- CFS_INIT_LIST_HEAD(&id_list);
-#ifndef KERNEL_SUPPORTS_QUOTA_READ
- rc = fsfilt_qids(obd, dqopt->files[type], NULL, type, &id_list);
-#else
- rc = fsfilt_qids(obd, NULL, dqopt->files[type], type, &id_list);
-#endif
- UNLOCK_DQONOFF_MUTEX(dqopt);
- if (rc)
- CERROR("Get ids from quota file failed. (rc:%d)\n", rc);
+ LASSERT(dqopt->files[type] != NULL);
+ CFS_INIT_LIST_HEAD(&id_list);
+ rc = fsfilt_qids(obd, NULL, dqopt->files[type], type, &id_list);
+ UNLOCK_DQONOFF_MUTEX(dqopt);
+ if (rc)
+ CERROR("Get ids from quota file failed. (rc:%d)\n", rc);
cfs_list_for_each_entry_safe(dqid, tmp, &id_list, di_link) {
cfs_list_del_init(&dqid->di_link);
return !(qctxt->lqc_flags & UGQUOTA2LQC(oqctl->qc_type));
}
-/**
+/*
* When quotaon, build a lqs for every uid/gid who has been set limitation
* for quota. After quota_search_lqs, it will hold one ref for the lqs.
* It will be released when qctxt_cleanup() is executed b=18574
*
- * Should be called with obt->obt_quotachecking held. b=20152
+ * Should be called with obt->obt_quotachecking held. b=20152
*/
void build_lqs(struct obd_device *obd)
{
if (sb_dqopt(qctxt->lqc_sb)->files[i] == NULL)
continue;
-#ifndef KERNEL_SUPPORTS_QUOTA_READ
- rc = fsfilt_qids(obd, sb_dqopt(qctxt->lqc_sb)->files[i], NULL,
- i, &id_list);
-#else
- rc = fsfilt_qids(obd, NULL, sb_dqopt(qctxt->lqc_sb)->files[i],
- i, &id_list);
-#endif
+ rc = fsfilt_qids(obd, NULL, sb_dqopt(qctxt->lqc_sb)->files[i],
+ i, &id_list);
if (rc) {
CERROR("%s: failed to get %s qids!\n", obd->obd_name,
i ? "group" : "user");