part of params_tree platform-independent code
i=andreas
i=alexg
libcfs_prim.h libcfs_time.h libcfs_hash.h \
libcfs_debug.h libcfsutil.h libcfs_ioctl.h \
libcfs_pack.h libcfs_unpack.h libcfs_string.h \
libcfs_prim.h libcfs_time.h libcfs_hash.h \
libcfs_debug.h libcfsutil.h libcfs_ioctl.h \
libcfs_pack.h libcfs_unpack.h libcfs_string.h \
- libcfs_kernelcomm.h libcfs_workitem.h \
+ libcfs_kernelcomm.h libcfs_workitem.h lucache.h \
* Lustre is a trademark of Sun Microsystems, Inc.
*/
* Lustre is a trademark of Sun Microsystems, Inc.
*/
-#ifndef _UPCALL_CACHE_H
-#define _UPCALL_CACHE_H
+#ifndef _LUCACHE_H
+#define _LUCACHE_H
+
+#ifndef EXPORT_SYMTAB
+# define EXPORT_SYMTAB
+#endif
+
+#include <libcfs/libcfs.h>
/** \defgroup ucache ucache
*
/** \defgroup ucache ucache
*
char uc_name[40]; /* for upcall */
char uc_upcall[UC_CACHE_UPCALL_MAXPATH];
char uc_name[40]; /* for upcall */
char uc_upcall[UC_CACHE_UPCALL_MAXPATH];
- cfs_time_t uc_acquire_expire; /* jiffies */
- cfs_time_t uc_entry_expire; /* jiffies */
+ int uc_acquire_expire; /* seconds */
+ int uc_entry_expire; /* seconds */
struct upcall_cache_ops *uc_ops;
};
struct upcall_cache_ops *uc_ops;
};
-#endif /* _UPCALL_CACHE_H */
endif
libcfs-all-objs := debug.o nidstrings.o lwt.o module.o tracefile.o watchdog.o \
endif
libcfs-all-objs := debug.o nidstrings.o lwt.o module.o tracefile.o watchdog.o \
- libcfs_string.o hash.o kernel_user_comm.o prng.o workitem.o
+ libcfs_string.o hash.o kernel_user_comm.o prng.o workitem.o \
+ upcall_cache.o
libcfs-objs := $(libcfs-linux-objs) $(libcfs-all-objs)
libcfs-objs := $(libcfs-linux-objs) $(libcfs-all-objs)
* This file is part of Lustre, http://www.lustre.org/
* Lustre is a trademark of Sun Microsystems, Inc.
*
* This file is part of Lustre, http://www.lustre.org/
* Lustre is a trademark of Sun Microsystems, Inc.
*
- * lustre/lvfs/upcall_cache.c
+ * libcfs/libcfs/upcall_cache.c
*
* Supplementary groups cache.
*/
*
* Supplementary groups cache.
*/
#define DEBUG_SUBSYSTEM S_SEC
#define DEBUG_SUBSYSTEM S_SEC
-#ifndef AUTOCONF_INCLUDED
-#include <linux/config.h>
-#endif
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/kmod.h>
-#include <linux/string.h>
-#include <linux/stat.h>
-#include <linux/errno.h>
-#include <linux/version.h>
-#include <linux/unistd.h>
-
-#include <asm/system.h>
-#include <asm/uaccess.h>
-
-#include <linux/fs.h>
-#include <linux/stat.h>
-#include <asm/uaccess.h>
-#include <linux/slab.h>
-
-#include <obd_support.h>
-#include <lustre_lib.h>
+#include <libcfs/lucache.h>
static struct upcall_cache_entry *alloc_entry(struct upcall_cache *cache,
__u64 key, void *args)
{
struct upcall_cache_entry *entry;
static struct upcall_cache_entry *alloc_entry(struct upcall_cache *cache,
__u64 key, void *args)
{
struct upcall_cache_entry *entry;
+ LIBCFS_ALLOC(entry, sizeof(*entry));
cfs_list_del(&entry->ue_hash);
CDEBUG(D_OTHER, "destroy cache entry %p for key "LPU64"\n",
entry, entry->ue_key);
cfs_list_del(&entry->ue_hash);
CDEBUG(D_OTHER, "destroy cache entry %p for key "LPU64"\n",
entry, entry->ue_key);
+ LIBCFS_FREE(entry, sizeof(*entry));
}
static inline int upcall_compare(struct upcall_cache *cache,
}
static inline int upcall_compare(struct upcall_cache *cache,
struct upcall_cache_entry *entry)
{
if (UC_CACHE_IS_VALID(entry) &&
struct upcall_cache_entry *entry)
{
if (UC_CACHE_IS_VALID(entry) &&
- cfs_time_before(jiffies, entry->ue_expire))
+ cfs_time_before(cfs_time_current(), entry->ue_expire))
return 0;
if (UC_CACHE_IS_ACQUIRING(entry)) {
if (entry->ue_acquire_expire == 0 ||
return 0;
if (UC_CACHE_IS_ACQUIRING(entry)) {
if (entry->ue_acquire_expire == 0 ||
- cfs_time_before(jiffies, entry->ue_acquire_expire))
+ cfs_time_before(cfs_time_current(),
+ entry->ue_acquire_expire))
return 0;
UC_CACHE_SET_EXPIRED(entry);
return 0;
UC_CACHE_SET_EXPIRED(entry);
cfs_spin_unlock(&cache->uc_lock);
rc = refresh_entry(cache, entry);
cfs_spin_lock(&cache->uc_lock);
cfs_spin_unlock(&cache->uc_lock);
rc = refresh_entry(cache, entry);
cfs_spin_lock(&cache->uc_lock);
- entry->ue_acquire_expire = jiffies + cache->uc_acquire_expire;
+ entry->ue_acquire_expire =
+ cfs_time_shift(cache->uc_acquire_expire);
if (rc < 0) {
UC_CACHE_CLEAR_ACQUIRING(entry);
UC_CACHE_SET_INVALID(entry);
if (rc < 0) {
UC_CACHE_CLEAR_ACQUIRING(entry);
UC_CACHE_SET_INVALID(entry);
/* someone (and only one) is doing upcall upon this item,
* wait it to complete */
if (UC_CACHE_IS_ACQUIRING(entry)) {
/* someone (and only one) is doing upcall upon this item,
* wait it to complete */
if (UC_CACHE_IS_ACQUIRING(entry)) {
- long expiry = (entry == new) ? cache->uc_acquire_expire :
- CFS_MAX_SCHEDULE_TIMEOUT;
+ long expiry = (entry == new) ?
+ cfs_time_seconds(cache->uc_acquire_expire) :
+ CFS_MAX_SCHEDULE_TIMEOUT;
long left;
cfs_waitlink_init(&wait);
long left;
cfs_waitlink_init(&wait);
- entry->ue_expire = jiffies + cache->uc_entry_expire;
+ entry->ue_expire = cfs_time_shift(cache->uc_entry_expire);
UC_CACHE_SET_VALID(entry);
CDEBUG(D_OTHER, "%s: created upcall cache entry %p for key "LPU64"\n",
cache->uc_name, entry, entry->ue_key);
UC_CACHE_SET_VALID(entry);
CDEBUG(D_OTHER, "%s: created upcall cache entry %p for key "LPU64"\n",
cache->uc_name, entry, entry->ue_key);
"cur %lu, ex %ld/%ld\n",
cache->uc_name, entry, entry->ue_key,
cfs_atomic_read(&entry->ue_refcount), entry->ue_flags,
"cur %lu, ex %ld/%ld\n",
cache->uc_name, entry, entry->ue_key,
cfs_atomic_read(&entry->ue_refcount), entry->ue_flags,
- get_seconds(), entry->ue_acquire_expire,
+ cfs_time_current_sec(), entry->ue_acquire_expire,
entry->ue_expire);
UC_CACHE_SET_EXPIRED(entry);
if (!cfs_atomic_read(&entry->ue_refcount))
entry->ue_expire);
UC_CACHE_SET_EXPIRED(entry);
if (!cfs_atomic_read(&entry->ue_refcount))
- OBD_ALLOC(cache, sizeof(*cache));
+ LIBCFS_ALLOC(cache, sizeof(*cache));
if (!cache)
RETURN(ERR_PTR(-ENOMEM));
if (!cache)
RETURN(ERR_PTR(-ENOMEM));
strncpy(cache->uc_name, name, sizeof(cache->uc_name) - 1);
/* upcall pathname proc tunable */
strncpy(cache->uc_upcall, upcall, sizeof(cache->uc_upcall) - 1);
strncpy(cache->uc_name, name, sizeof(cache->uc_name) - 1);
/* upcall pathname proc tunable */
strncpy(cache->uc_upcall, upcall, sizeof(cache->uc_upcall) - 1);
- cache->uc_entry_expire = 20 * 60 * CFS_HZ;
- cache->uc_acquire_expire = 30 * CFS_HZ;
+ cache->uc_entry_expire = 20 * 60;
+ cache->uc_acquire_expire = 30;
cache->uc_ops = ops;
RETURN(cache);
cache->uc_ops = ops;
RETURN(cache);
if (!cache)
return;
upcall_cache_flush_all(cache);
if (!cache)
return;
upcall_cache_flush_all(cache);
- OBD_FREE(cache, sizeof(*cache));
+ LIBCFS_FREE(cache, sizeof(*cache));
}
EXPORT_SYMBOL(upcall_cache_cleanup);
}
EXPORT_SYMBOL(upcall_cache_cleanup);
lustre_debug.h lustre_disk.h lustre_dlm.h lustre_export.h \
lustre_fsfilt.h lustre_ha.h lustre_handles.h lustre_import.h \
lustre_lib.h lustre_sec.h lustre_lite.h lustre_log.h lustre_mds.h \
lustre_debug.h lustre_disk.h lustre_dlm.h lustre_export.h \
lustre_fsfilt.h lustre_ha.h lustre_handles.h lustre_import.h \
lustre_lib.h lustre_sec.h lustre_lite.h lustre_log.h lustre_mds.h \
- lustre_mdc.h lustre_net.h lustre_quota.h lustre_ucache.h lvfs.h \
+ lustre_mdc.h lustre_net.h lustre_quota.h lvfs.h \
obd_cache.h obd_class.h obd.h obd_lov.h \
obd_ost.h obd_support.h lustre_ver.h lu_object.h lu_time.h \
md_object.h dt_object.h lustre_param.h lustre_mdt.h \
obd_cache.h obd_class.h obd.h obd_lov.h \
obd_ost.h obd_support.h lustre_ver.h lu_object.h lu_time.h \
md_object.h dt_object.h lustre_param.h lustre_mdt.h \
#error Unsupported operating system.
#endif
#error Unsupported operating system.
#endif
-#include <lustre_ucache.h>
+#include <libcfs/lucache.h>
@SERVER_TRUE@MODULES += fsfilt_@BACKINGFS@
@QUOTA_TRUE@MODULES += quotafmt_test
@SERVER_TRUE@MODULES += fsfilt_@BACKINGFS@
@QUOTA_TRUE@MODULES += quotafmt_test
-lvfs-objs := lvfs_common.o lvfs_linux.o fsfilt.o upcall_cache.o lvfs_lib.o
+lvfs-objs := lvfs_common.o lvfs_linux.o fsfilt.o lvfs_lib.o
@QUOTA_TRUE@quotafmt-objs := quotafmt_test.o
@QUOTA_TRUE@quotafmt-objs := quotafmt_test.o
#include <linux/slab.h>
#include <libcfs/libcfs.h>
#include <linux/slab.h>
#include <libcfs/libcfs.h>
+#include <libcfs/lucache.h>
#include <obd.h>
#include <obd_class.h>
#include <obd_support.h>
#include <obd.h>
#include <obd_class.h>
#include <obd_support.h>
#include <lustre_import.h>
#include <lustre_dlm.h>
#include <lustre_lib.h>
#include <lustre_import.h>
#include <lustre_dlm.h>
#include <lustre_lib.h>
-#include <lustre_ucache.h>
#include "mdt_internal.h"
#include "mdt_internal.h"
#include <linux/slab.h>
#include <libcfs/libcfs.h>
#include <linux/slab.h>
#include <libcfs/libcfs.h>
+#include <libcfs/lucache.h>
#include <obd.h>
#include <obd_class.h>
#include <obd_support.h>
#include <obd.h>
#include <obd_class.h>
#include <obd_support.h>
#include <lustre_dlm.h>
#include <lustre_sec.h>
#include <lustre_lib.h>
#include <lustre_dlm.h>
#include <lustre_sec.h>
#include <lustre_lib.h>
-#include <lustre_ucache.h>
#include "mdt_internal.h"
#include "mdt_internal.h"
struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
*eof = 1;
struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
*eof = 1;
- return snprintf(page, count, "%lu\n",
- mdt->mdt_identity_cache->uc_entry_expire / CFS_HZ);
+ return snprintf(page, count, "%u\n",
+ mdt->mdt_identity_cache->uc_entry_expire);
}
static int lprocfs_wr_identity_expire(struct file *file, const char *buffer,
}
static int lprocfs_wr_identity_expire(struct file *file, const char *buffer,
- mdt->mdt_identity_cache->uc_entry_expire = val * CFS_HZ;
+ mdt->mdt_identity_cache->uc_entry_expire = val;
struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
*eof = 1;
struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
*eof = 1;
- return snprintf(page, count, "%lu\n",
- mdt->mdt_identity_cache->uc_acquire_expire / CFS_HZ);
+ return snprintf(page, count, "%u\n",
+ mdt->mdt_identity_cache->uc_acquire_expire);
}
static int lprocfs_wr_identity_acquire_expire(struct file *file,
}
static int lprocfs_wr_identity_acquire_expire(struct file *file,
- mdt->mdt_identity_cache->uc_acquire_expire = val * CFS_HZ;
+ mdt->mdt_identity_cache->uc_acquire_expire = val;