-MODULES := fld
-fld-objs := fld_handler.o fld_request.o fld_cache.o fld_index.o lproc_fld.o
+MODULES := fld
+fld-objs := fld_request.o fld_cache.o lproc_fld.o
+@SERVER_TRUE@fld-objs += fld_handler.o fld_index.o
-EXTRA_PRE_CFLAGS := -I@LUSTRE@ -I@LUSTRE@/ldiskfs
+EXTRA_PRE_CFLAGS := -I@LUSTRE@
@INCLUDE_RULES@
if LIBLUSTRE
noinst_LIBRARIES = libfld.a
-libfld_a_SOURCES = fld_handler.c fld_request.c fld_cache.c lproc_fld.c fld_internal.h
+libfld_a_SOURCES = fld_request.c fld_cache.c lproc_fld.c fld_internal.h
libfld_a_CPPFLAGS = $(LLCPPFLAGS)
libfld_a_CFLAGS = $(LLCFLAGS)
endif
modulefs_DATA = fld$(KMODEXT)
endif
-MOSTLYCLEANFILES := @MOSTLYCLEANFILES@
+MOSTLYCLEANFILES := @MOSTLYCLEANFILES@
EXTRA_DIST := $(fld-objs:%.o=%.c) fld_internal.h
#ifdef __KERNEL__
# include <libcfs/libcfs.h>
# include <linux/module.h>
-# include <linux/jbd.h>
# include <asm/div64.h>
#else /* __KERNEL__ */
# include <liblustre.h>
# include <libcfs/list.h>
#endif
-#include <obd.h>
-#include <obd_class.h>
-#include <lustre_ver.h>
#include <obd_support.h>
-#include <lprocfs_status.h>
-
-#include <dt_object.h>
-#include <md_object.h>
-#include <lustre_req_layout.h>
#include <lustre_fld.h>
#include "fld_internal.h"
* entry accordingly.
*/
-void fld_cache_punch_hole(struct fld_cache *cache,
- struct fld_cache_entry *f_curr,
- struct fld_cache_entry *f_new)
+static void fld_cache_punch_hole(struct fld_cache *cache,
+ struct fld_cache_entry *f_curr,
+ struct fld_cache_entry *f_new)
{
const struct lu_seq_range *range = &f_new->fce_range;
const seqno_t new_start = range->lsr_start;
write_unlock(&cache->fci_lock);
}
-struct fld_cache_entry
-*fld_cache_entry_lookup_nolock(struct fld_cache *cache,
- struct lu_seq_range *range)
+struct fld_cache_entry *
+fld_cache_entry_lookup_nolock(struct fld_cache *cache,
+ const struct lu_seq_range *range)
{
struct fld_cache_entry *flde;
struct fld_cache_entry *got = NULL;
/**
* lookup \a seq sequence for range in fld cache.
*/
-struct fld_cache_entry
-*fld_cache_entry_lookup(struct fld_cache *cache, struct lu_seq_range *range)
+struct fld_cache_entry *
+fld_cache_entry_lookup(struct fld_cache *cache,
+ const struct lu_seq_range *range)
{
struct fld_cache_entry *got = NULL;
ENTRY;
read_lock(&cache->fci_lock);
got = fld_cache_entry_lookup_nolock(cache, range);
read_unlock(&cache->fci_lock);
+
RETURN(got);
}
read_unlock(&cache->fci_lock);
RETURN(-ENOENT);
}
-
#define DEBUG_SUBSYSTEM S_FLD
-#ifdef __KERNEL__
-# include <libcfs/libcfs.h>
-# include <linux/module.h>
-# include <linux/jbd.h>
-# include <asm/div64.h>
-#else /* __KERNEL__ */
-# include <liblustre.h>
-# include <libcfs/list.h>
-#endif
+#include <libcfs/libcfs.h>
+#include <linux/module.h>
#include <obd.h>
-#include <obd_class.h>
-#include <lustre_ver.h>
#include <obd_support.h>
-#include <lprocfs_status.h>
-
-#include <md_object.h>
#include <lustre_fid.h>
+#include <lustre_fld.h>
+#include <lustre_mdt.h> /* err_serious() */
#include <lustre_req_layout.h>
+#include <lprocfs_status.h>
#include "fld_internal.h"
-#include <lustre_fid.h>
-
-#ifdef __KERNEL__
/* context key constructor/destructor: fld_key_init, fld_key_fini */
LU_KEY_INIT_FINI(fld, struct fld_thread_info);
/* context key: fld_thread_key */
LU_CONTEXT_KEY_DEFINE(fld, LCT_MD_THREAD | LCT_DT_THREAD | LCT_MG_THREAD);
-cfs_proc_dir_entry_t *fld_type_proc_dir = NULL;
-
-static int __init fld_mod_init(void)
+int fld_server_mod_init(void)
{
- fld_type_proc_dir = lprocfs_register(LUSTRE_FLD_NAME,
- proc_lustre_root,
- NULL, NULL);
- if (IS_ERR(fld_type_proc_dir))
- return PTR_ERR(fld_type_proc_dir);
-
- LU_CONTEXT_KEY_INIT(&fld_thread_key);
- lu_context_key_register(&fld_thread_key);
- return 0;
+ LU_CONTEXT_KEY_INIT(&fld_thread_key);
+ return lu_context_key_register(&fld_thread_key);
}
-static void __exit fld_mod_exit(void)
+void fld_server_mod_exit(void)
{
- lu_context_key_degister(&fld_thread_key);
- if (fld_type_proc_dir != NULL && !IS_ERR(fld_type_proc_dir)) {
- lprocfs_remove(&fld_type_proc_dir);
- fld_type_proc_dir = NULL;
- }
+ lu_context_key_degister(&fld_thread_key);
}
int fld_declare_server_create(const struct lu_env *env,
struct lu_server_fld *fld,
- struct lu_seq_range *range,
+ const struct lu_seq_range *range,
struct thandle *th)
{
int rc;
* is granted to a server.
*/
int fld_server_create(const struct lu_env *env, struct lu_server_fld *fld,
- struct lu_seq_range *range, struct thandle *th)
+ const struct lu_seq_range *range, struct thandle *th)
{
int rc;
EXIT;
}
EXPORT_SYMBOL(fld_server_fini);
-
-MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
-MODULE_DESCRIPTION("Lustre FLD");
-MODULE_LICENSE("GPL");
-
-cfs_module(mdd, "0.1.0", fld_mod_init, fld_mod_exit);
-#endif
#ifdef __KERNEL__
# include <libcfs/libcfs.h>
# include <linux/module.h>
-# include <linux/jbd.h>
#else /* __KERNEL__ */
# include <liblustre.h>
#endif
-#include <obd.h>
-#include <obd_class.h>
-#include <lustre_ver.h>
#include <obd_support.h>
-#include <lprocfs_status.h>
-
#include <dt_object.h>
-#include <md_object.h>
-#include <lustre_mdc.h>
#include <lustre_fid.h>
#include <lustre_fld.h>
#include "fld_internal.h"
-const char fld_index_name[] = "fld";
+static const char fld_index_name[] = "fld";
static const struct lu_seq_range IGIF_FLD_RANGE = {
.lsr_start = FID_SEQ_IGIF,
.lsr_flags = LU_SEQ_RANGE_MDT
};
-const struct dt_index_features fld_index_features = {
+static const struct dt_index_features fld_index_features = {
.dif_flags = DT_IND_UPDATE,
.dif_keysize_min = sizeof(seqno_t),
.dif_keysize_max = sizeof(seqno_t),
fld->lsf_name, PRANGE(range), rc);
GOTO(out, rc);
}
- memcpy(tmp, new_range, sizeof(*new_range));
+ *tmp = *new_range;
tmp->lsr_start = range->lsr_start;
} else {
- memcpy(tmp, new_range, sizeof(*new_range));
+ *tmp = *new_range;
}
range_cpu_to_be(tmp, tmp);
BYPASS_CAPA);
if (rc != 0)
GOTO(out, rc);
- memcpy(tmp, new_range, sizeof(*new_range));
+ *tmp = *new_range;
tmp->lsr_start = range->lsr_start;
deleted = 1;
} else {
- memcpy(tmp, new_range, sizeof(*new_range));
+ *tmp = *new_range;
}
range_cpu_to_be(tmp, tmp);
#ifndef __FLD_INTERNAL_H
#define __FLD_INTERNAL_H
+#include <obd.h>
#include <lustre/lustre_idl.h>
-#include <dt_object.h>
-
#include <libcfs/libcfs.h>
-#include <lustre_req_layout.h>
#include <lustre_fld.h>
enum {
struct fld_stats {
__u64 fst_count;
__u64 fst_cache;
- __u64 fst_inflight;
};
typedef int (*fld_hash_func_t) (struct lu_client_fld *, __u64);
#ifdef __KERNEL__
+# ifdef LPROCFS
+extern struct proc_dir_entry *fld_type_proc_dir;
+extern struct lprocfs_vars fld_client_proc_list[];
+# endif
+
+# ifdef HAVE_SERVER_SUPPORT
+struct req_capsule;
struct fld_thread_info {
- struct req_capsule *fti_pill;
- __u64 fti_key;
- struct lu_seq_range fti_rec;
- struct lu_seq_range fti_lrange;
- struct lu_seq_range fti_irange;
+ struct req_capsule *fti_pill;
+ struct lu_seq_range fti_rec;
+ struct lu_seq_range fti_lrange;
+ struct lu_seq_range fti_irange;
};
extern struct lu_context_key fld_thread_key;
+struct dt_device;
int fld_index_init(const struct lu_env *env, struct lu_server_fld *fld,
struct dt_device *dt);
int fld_declare_index_create(const struct lu_env *env,
struct lu_server_fld *fld,
- const struct lu_seq_range *new,
+ const struct lu_seq_range *new_range,
struct thandle *th);
int fld_index_create(const struct lu_env *env, struct lu_server_fld *fld,
- const struct lu_seq_range *new, struct thandle *th);
+ const struct lu_seq_range *new_range, struct thandle *th);
int fld_index_lookup(const struct lu_env *env, struct lu_server_fld *fld,
seqno_t seq, struct lu_seq_range *range);
-int fld_client_rpc(struct obd_export *exp,
- struct lu_seq_range *range, __u32 fld_op);
+int fld_server_mod_init(void);
-#ifdef LPROCFS
+void fld_server_mod_exit(void);
+
+# ifdef LPROCFS
+extern const struct file_operations fld_proc_seq_fops;
extern struct lprocfs_vars fld_server_proc_list[];
-extern struct lprocfs_vars fld_client_proc_list[];
-#endif
+# endif
-#endif
+# endif /* HAVE_SERVER_SUPPORT */
+
+int fld_client_rpc(struct obd_export *exp,
+ struct lu_seq_range *range, __u32 fld_op);
+
+#endif /* __KERNEL__ */
struct fld_cache *fld_cache_init(const char *name,
int cache_size, int cache_threshold);
int fld_cache_lookup(struct fld_cache *cache,
const seqno_t seq, struct lu_seq_range *range);
-struct fld_cache_entry*
-fld_cache_entry_lookup(struct fld_cache *cache, struct lu_seq_range *range);
+struct fld_cache_entry *
+fld_cache_entry_lookup(struct fld_cache *cache,
+ const struct lu_seq_range *range);
+
void fld_cache_entry_delete(struct fld_cache *cache,
struct fld_cache_entry *node);
-void fld_dump_cache_entries(struct fld_cache *cache);
-struct fld_cache_entry
-*fld_cache_entry_lookup_nolock(struct fld_cache *cache,
- struct lu_seq_range *range);
-int fld_write_range(const struct lu_env *env, struct dt_object *dt,
- const struct lu_seq_range *range, struct thandle *th);
+struct fld_cache_entry *
+fld_cache_entry_lookup_nolock(struct fld_cache *cache,
+ const struct lu_seq_range *range);
static inline const char *
-fld_target_name(struct lu_fld_target *tar)
+fld_target_name(const struct lu_fld_target *tar)
{
- if (tar->ft_srv != NULL)
- return tar->ft_srv->lsf_name;
+#ifdef HAVE_SERVER_SUPPORT
+ if (tar->ft_srv != NULL)
+ return tar->ft_srv->lsf_name;
+#endif
- return (const char *)tar->ft_exp->exp_obd->obd_name;
+ return tar->ft_exp->exp_obd->obd_name;
}
-extern cfs_proc_dir_entry_t *fld_type_proc_dir;
-extern struct file_operations fld_proc_seq_fops;
#endif /* __FLD_INTERNAL_H */
#ifdef __KERNEL__
# include <libcfs/libcfs.h>
# include <linux/module.h>
-# include <linux/jbd.h>
# include <asm/div64.h>
#else /* __KERNEL__ */
# include <liblustre.h>
#include <obd.h>
#include <obd_class.h>
-#include <lustre_ver.h>
#include <obd_support.h>
#include <lprocfs_status.h>
-
-#include <dt_object.h>
-#include <md_object.h>
#include <lustre_req_layout.h>
#include <lustre_fld.h>
#include <lustre_mdc.h>
res.lsr_start = seq;
fld_range_set_type(&res, flags);
-#ifdef __KERNEL__
+
+#if defined(__KERNEL__) && defined(HAVE_SERVER_SUPPORT)
if (target->ft_srv != NULL) {
LASSERT(env != NULL);
rc = fld_server_lookup(env, target->ft_srv, seq, &res);
- } else {
+ } else
#endif
+ {
rc = fld_client_rpc(target->ft_exp, &res, FLD_LOOKUP);
-#ifdef __KERNEL__
}
-#endif
if (rc == 0) {
*mds = res.lsr_index;
-
fld_cache_insert(fld->lcf_cache, &res);
}
+
RETURN(rc);
}
EXPORT_SYMBOL(fld_client_lookup);
fld_cache_flush(fld->lcf_cache);
}
EXPORT_SYMBOL(fld_client_flush);
+
+#ifdef __KERNEL__
+
+struct proc_dir_entry *fld_type_proc_dir;
+
+static int __init fld_mod_init(void)
+{
+ fld_type_proc_dir = lprocfs_register(LUSTRE_FLD_NAME,
+ proc_lustre_root,
+ NULL, NULL);
+ if (IS_ERR(fld_type_proc_dir))
+ return PTR_ERR(fld_type_proc_dir);
+
+#ifdef HAVE_SERVER_SUPPORT
+ fld_server_mod_init();
+#endif
+
+ return 0;
+}
+
+static void __exit fld_mod_exit(void)
+{
+#ifdef HAVE_SERVER_SUPPORT
+ fld_server_mod_exit();
+#endif
+
+ if (fld_type_proc_dir != NULL && !IS_ERR(fld_type_proc_dir)) {
+ lprocfs_remove(&fld_type_proc_dir);
+ fld_type_proc_dir = NULL;
+ }
+}
+
+MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
+MODULE_DESCRIPTION("Lustre FLD");
+MODULE_LICENSE("GPL");
+
+cfs_module(mdd, LUSTRE_VERSION_STRING, fld_mod_init, fld_mod_exit);
+#endif /* __KERNEL__ */
# include <liblustre.h>
#endif
-#include <obd.h>
-#include <obd_class.h>
#include <dt_object.h>
-#include <md_object.h>
#include <obd_support.h>
-#include <lustre_req_layout.h>
#include <lustre_fld.h>
#include <lustre_fid.h>
#include "fld_internal.h"
unsigned int fsp_stop:1;
};
+struct lprocfs_vars fld_client_proc_list[] = {
+ { "targets", fld_proc_read_targets, NULL, NULL },
+ { "hash", fld_proc_read_hash, fld_proc_write_hash, NULL },
+ { "cache_flush", NULL, fld_proc_write_cache_flush, NULL },
+ { NULL }
+};
+
+# ifdef HAVE_SERVER_SUPPORT
static void *fldb_seq_start(struct seq_file *p, loff_t *pos)
{
struct fld_seq_param *param = p->private;
return 0;
}
-struct lprocfs_vars fld_server_proc_list[] = {
- { NULL }};
-
-struct lprocfs_vars fld_client_proc_list[] = {
- { "targets", fld_proc_read_targets, NULL, NULL },
- { "hash", fld_proc_read_hash, fld_proc_write_hash, NULL },
- { "cache_flush", NULL, fld_proc_write_cache_flush, NULL },
- { NULL }};
-
-struct file_operations fld_proc_seq_fops = {
+const struct file_operations fld_proc_seq_fops = {
.owner = THIS_MODULE,
.open = fldb_seq_open,
.read = seq_read,
.release = fldb_seq_release,
};
-#endif
+struct lprocfs_vars fld_server_proc_list[] = {
+ { NULL }
+};
+
+# endif /* HAVE_SERVER_SUPPORT */
+
+#endif /* LPROCFS */
*/
#include <lustre/lustre_idl.h>
-#include <lustre_mdt.h>
-#include <dt_object.h>
-
#include <libcfs/libcfs.h>
+struct lu_env;
struct lu_client_fld;
struct lu_server_fld;
struct lu_fld_hash;
struct fld_cache;
-
-extern const struct dt_index_features fld_index_features;
-extern const char fld_index_name[];
+struct thandle;
+struct dt_device;
+struct dt_object;
/*
* FLD (Fid Location Database) interface.
LUSTRE_CLI_FLD_HASH_RRB
};
-
struct lu_fld_target {
- cfs_list_t ft_chain;
- struct obd_export *ft_exp;
- struct lu_server_fld *ft_srv;
- __u64 ft_idx;
+ cfs_list_t ft_chain;
+ struct obd_export *ft_exp;
+ struct lu_server_fld *ft_srv;
+ __u64 ft_idx;
};
struct lu_server_fld {
* Client fld proc entry name. */
char lcf_name[80];
- const struct lu_context *lcf_ctx;
-
- int lcf_flags;
-};
-
-/**
- * number of blocks to reserve for particular operations. Should be function of
- * ... something. Stub for now.
- */
-enum {
- /* one insert operation can involve two delete and one insert */
- FLD_TXN_INDEX_INSERT_CREDITS = 60,
- FLD_TXN_INDEX_DELETE_CREDITS = 20,
+ int lcf_flags;
};
+struct com_thread_info;
int fld_query(struct com_thread_info *info);
/* Server methods */
int fld_declare_server_create(const struct lu_env *env,
struct lu_server_fld *fld,
- struct lu_seq_range *new,
+ const struct lu_seq_range *range,
struct thandle *th);
int fld_server_create(const struct lu_env *env,
struct lu_server_fld *fld,
- struct lu_seq_range *add_range,
+ const struct lu_seq_range *add_range,
struct thandle *th);
int fld_insert_entry(const struct lu_env *env,
struct obd_export;
enum {
- UCRED_INVALID = -1,
- UCRED_INIT = 0,
- UCRED_OLD = 1,
- UCRED_NEW = 2
-};
-
-enum {
MD_CAPAINFO_MAX = 5
};
int lustre_buf2hsm(void *buf, int rc, struct md_hsm *mh);
void lustre_hsm2buf(void *buf, struct md_hsm *mh);
+enum {
+ UCRED_INVALID = -1,
+ UCRED_INIT = 0,
+ UCRED_OLD = 1,
+ UCRED_NEW = 2,
+};
+
struct lu_ucred {
__u32 uc_valid;
__u32 uc_o_uid;
#include <libcfs/list.h>
#include <lu_object.h>
#include <dt_object.h>
+#include <md_object.h>
+#include <lustre_fld.h>
#include <lustre_lib.h>
#include <lustre_net.h>
#include <lustre_lfsck.h>
#include <lustre/lustre_idl.h>
#include <lu_object.h>
#include <dt_object.h>
+#include <md_object.h>
#include <lustre_linkea.h>
#include <lustre_fid.h>
#include <lustre_lib.h>
#include <md_object.h>
#include <lustre_fid.h>
#include <lustre_fld.h>
+#include <lustre_mdt.h>
#include <lustre_req_layout.h>
#include <lustre_sec.h>
#include <lvfs.h>
#include <lustre_debug.h>
#include <lprocfs_status.h>
#include <cl_object.h>
+#include <md_object.h>
#include <lustre_fid.h>
#include <lustre_acl.h>
#include <lustre_net.h>
#include <obd_class.h>
#include <lustre_disk.h>
#include <lustre_fid.h>
+#include <md_object.h>
#include "osd_internal.h"
* Use is subject to license terms.
*/
-#include "lquota_internal.h"
-
#ifndef _QMT_INTERNAL_H
#define _QMT_INTERNAL_H
+#include <lustre_mdt.h> /* err_serious() */
+#include "lquota_internal.h"
+
/*
* The Quota Master Target Device.
* The qmt is responsible for: