MODULES := fid
-fid-objs := fid_handler.o fid_store.o fid_request.o lproc_fid.o fid_lib.o
-
+fid-objs := fid_request.o lproc_fid.o
+@SERVER_TRUE@fid-objs += fid_handler.o fid_store.o fid_lib.o
@INCLUDE_RULES@
if LIBLUSTRE
noinst_LIBRARIES = libfid.a
-libfid_a_SOURCES = fid_handler.c fid_store.c fid_request.c lproc_fid.c fid_lib.c fid_internal.h
+libfid_a_SOURCES = fid_request.c fid_internal.h
libfid_a_CPPFLAGS = $(LLCPPFLAGS)
libfid_a_CFLAGS = $(LLCFLAGS)
endif
#define DEBUG_SUBSYSTEM S_FID
-#ifdef __KERNEL__
-# include <libcfs/libcfs.h>
-# include <linux/module.h>
-#else /* __KERNEL__ */
-# include <liblustre.h>
-#endif
-
+#include <libcfs/libcfs.h>
+#include <linux/module.h>
#include <obd.h>
#include <obd_class.h>
#include <dt_object.h>
#include <obd_support.h>
#include <lustre_req_layout.h>
#include <lustre_fid.h>
+#include <lustre_mdt.h> /* err_serious() */
#include "fid_internal.h"
-int client_fid_init(struct obd_device *obd,
- struct obd_export *exp, enum lu_cli_type type)
-{
- struct client_obd *cli = &obd->u.cli;
- char *prefix;
- int rc;
- ENTRY;
-
- OBD_ALLOC_PTR(cli->cl_seq);
- if (cli->cl_seq == NULL)
- RETURN(-ENOMEM);
-
- OBD_ALLOC(prefix, MAX_OBD_NAME + 5);
- if (prefix == NULL)
- GOTO(out_free_seq, rc = -ENOMEM);
-
- snprintf(prefix, MAX_OBD_NAME + 5, "cli-%s", obd->obd_name);
-
- /* Init client side sequence-manager */
- rc = seq_client_init(cli->cl_seq, exp, type, prefix, NULL);
- OBD_FREE(prefix, MAX_OBD_NAME + 5);
- if (rc)
- GOTO(out_free_seq, rc);
-
- RETURN(rc);
-out_free_seq:
- OBD_FREE_PTR(cli->cl_seq);
- cli->cl_seq = NULL;
- return rc;
-}
-EXPORT_SYMBOL(client_fid_init);
-
-int client_fid_fini(struct obd_device *obd)
-{
- struct client_obd *cli = &obd->u.cli;
- ENTRY;
-
- if (cli->cl_seq != NULL) {
- seq_client_fini(cli->cl_seq);
- OBD_FREE_PTR(cli->cl_seq);
- cli->cl_seq = NULL;
- }
-
- RETURN(0);
-}
-EXPORT_SYMBOL(client_fid_fini);
-
-#ifdef __KERNEL__
static void seq_server_proc_fini(struct lu_server_seq *seq);
/* Assigns client to sequence controller node. */
}
EXPORT_SYMBOL(seq_query);
-
-#ifdef LPROCFS
static int seq_server_proc_init(struct lu_server_seq *seq)
{
+#ifdef LPROCFS
+
int rc;
ENTRY;
out_cleanup:
seq_server_proc_fini(seq);
return rc;
+#else /* LPROCFS */
+ return 0;
+#endif
}
static void seq_server_proc_fini(struct lu_server_seq *seq)
{
+#ifdef LPROCFS
ENTRY;
if (seq->lss_proc_dir != NULL) {
if (!IS_ERR(seq->lss_proc_dir))
seq->lss_proc_dir = NULL;
}
EXIT;
-}
-#else
-static int seq_server_proc_init(struct lu_server_seq *seq)
-{
- return 0;
+#endif /* LPROCFS */
}
-static void seq_server_proc_fini(struct lu_server_seq *seq)
-{
- return;
-}
-#endif
-
-
int seq_server_init(struct lu_server_seq *seq,
struct dt_device *dev,
const char *prefix,
}
EXPORT_SYMBOL(seq_site_fini);
-cfs_proc_dir_entry_t *seq_type_proc_dir = NULL;
-
-static int __init fid_mod_init(void)
+int fid_server_mod_init(void)
{
- seq_type_proc_dir = lprocfs_register(LUSTRE_SEQ_NAME,
- proc_lustre_root,
- NULL, NULL);
- if (IS_ERR(seq_type_proc_dir))
- return PTR_ERR(seq_type_proc_dir);
-
- LU_CONTEXT_KEY_INIT(&seq_thread_key);
- lu_context_key_register(&seq_thread_key);
- return 0;
+ LU_CONTEXT_KEY_INIT(&seq_thread_key);
+ return lu_context_key_register(&seq_thread_key);
}
-static void __exit fid_mod_exit(void)
+void fid_server_mod_exit(void)
{
- lu_context_key_degister(&seq_thread_key);
- if (seq_type_proc_dir != NULL && !IS_ERR(seq_type_proc_dir)) {
- lprocfs_remove(&seq_type_proc_dir);
- seq_type_proc_dir = NULL;
- }
+ lu_context_key_degister(&seq_thread_key);
}
-
-MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
-MODULE_DESCRIPTION("Lustre FID Module");
-MODULE_LICENSE("GPL");
-
-cfs_module(fid, "0.1.0", fid_mod_init, fid_mod_exit);
-#endif
#define __FID_INTERNAL_H
#include <lustre/lustre_idl.h>
-#include <dt_object.h>
-
#include <libcfs/libcfs.h>
#ifdef __KERNEL__
+# ifdef HAVE_SERVER_SUPPORT
+# define HAVE_SEQ_SERVER
+
+struct req_capsule;
+
struct seq_thread_info {
struct req_capsule *sti_pill;
struct lu_seq_range sti_space;
extern struct lu_context_key seq_thread_key;
-/* Functions used internally in module. */
-int seq_client_alloc_super(struct lu_client_seq *seq,
- const struct lu_env *env);
+# ifdef LPROCFS
+extern struct lprocfs_vars seq_server_proc_list[];
+# endif
/* Store API functions. */
+struct dt_device;
+
int seq_store_init(struct lu_server_seq *seq,
- const struct lu_env *env,
- struct dt_device *dt);
+ const struct lu_env *env,
+ struct dt_device *dt);
void seq_store_fini(struct lu_server_seq *seq,
- const struct lu_env *env);
+ const struct lu_env *env);
int seq_store_read(struct lu_server_seq *seq,
- const struct lu_env *env);
+ const struct lu_env *env);
int seq_store_update(const struct lu_env *env, struct lu_server_seq *seq,
- struct lu_seq_range *out, int sync);
+ struct lu_seq_range *out, int sync);
-#ifdef LPROCFS
-extern struct lprocfs_vars seq_server_proc_list[];
+int fid_server_mod_init(void);
+
+void fid_server_mod_exit(void);
+
+# endif /* HAVE_SERVER_SUPPORT */
+
+/* Functions used internally in module. */
+int seq_client_alloc_super(struct lu_client_seq *seq,
+ const struct lu_env *env);
+
+# ifdef LPROCFS
extern struct lprocfs_vars seq_client_proc_list[];
-#endif
+# endif
-#endif
+#endif /* __KERNEL__ */
-extern cfs_proc_dir_entry_t *seq_type_proc_dir;
+extern struct proc_dir_entry *seq_type_proc_dir;
#endif /* __FID_INTERNAL_H */
#define DEBUG_SUBSYSTEM S_FID
-#ifdef __KERNEL__
-# include <libcfs/libcfs.h>
-# include <linux/module.h>
-#else /* __KERNEL__ */
-# include <liblustre.h>
-#endif
-
-#include <obd.h>
-#include <lu_object.h>
+#include <libcfs/libcfs.h>
+#include <linux/module.h>
+#include <lustre/lustre_idl.h>
#include <lustre_fid.h>
/**
#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_fid.h>
/* mdc RPC locks */
#include <lustre_mdc.h>
mutex_lock(&seq->lcs_mutex);
-#ifdef __KERNEL__
if (seq->lcs_srv) {
+#ifdef HAVE_SEQ_SERVER
LASSERT(env != NULL);
rc = seq_server_alloc_super(seq->lcs_srv, &seq->lcs_space,
env);
- } else {
+#else
+ rc = 0;
#endif
+ } else {
/* Check whether the connection to seq controller has been
* setup (lcs_exp != NULL) */
if (seq->lcs_exp == NULL) {
rc = seq_client_rpc(seq, &seq->lcs_space,
SEQ_ALLOC_SUPER, "super");
-#ifdef __KERNEL__
}
-#endif
mutex_unlock(&seq->lcs_mutex);
RETURN(rc);
}
int rc;
ENTRY;
-#ifdef __KERNEL__
if (seq->lcs_srv) {
+#ifdef HAVE_SEQ_SERVER
LASSERT(env != NULL);
rc = seq_server_alloc_meta(seq->lcs_srv, &seq->lcs_space, env);
- } else {
+#else
+ rc = 0;
#endif
+ } else {
do {
/* If meta server return -EINPROGRESS or EAGAIN,
* it means meta server might not be ready to
rc = seq_client_rpc(seq, &seq->lcs_space,
SEQ_ALLOC_META, "meta");
} while (rc == -EINPROGRESS || rc == -EAGAIN);
-#ifdef __KERNEL__
}
-#endif
+
RETURN(rc);
}
}
EXPORT_SYMBOL(seq_client_flush);
-static void seq_client_proc_fini(struct lu_client_seq *seq);
-
+static void seq_client_proc_fini(struct lu_client_seq *seq)
+{
#ifdef LPROCFS
+ ENTRY;
+ if (seq->lcs_proc_dir) {
+ if (!IS_ERR(seq->lcs_proc_dir))
+ lprocfs_remove(&seq->lcs_proc_dir);
+ seq->lcs_proc_dir = NULL;
+ }
+ EXIT;
+#endif /* LPROCFS */
+}
+
static int seq_client_proc_init(struct lu_client_seq *seq)
{
+#ifdef LPROCFS
int rc;
ENTRY;
out_cleanup:
seq_client_proc_fini(seq);
return rc;
-}
-
-static void seq_client_proc_fini(struct lu_client_seq *seq)
-{
- ENTRY;
- if (seq->lcs_proc_dir) {
- if (!IS_ERR(seq->lcs_proc_dir))
- lprocfs_remove(&seq->lcs_proc_dir);
- seq->lcs_proc_dir = NULL;
- }
- EXIT;
-}
-#else
-static int seq_client_proc_init(struct lu_client_seq *seq)
-{
- return 0;
-}
-static void seq_client_proc_fini(struct lu_client_seq *seq)
-{
- return;
-}
+#else /* LPROCFS */
+ return 0;
#endif
+}
int seq_client_init(struct lu_client_seq *seq,
struct obd_export *exp,
EXIT;
}
EXPORT_SYMBOL(seq_client_fini);
+
+int client_fid_init(struct obd_device *obd,
+ struct obd_export *exp, enum lu_cli_type type)
+{
+ struct client_obd *cli = &obd->u.cli;
+ char *prefix;
+ int rc;
+ ENTRY;
+
+ OBD_ALLOC_PTR(cli->cl_seq);
+ if (cli->cl_seq == NULL)
+ RETURN(-ENOMEM);
+
+ OBD_ALLOC(prefix, MAX_OBD_NAME + 5);
+ if (prefix == NULL)
+ GOTO(out_free_seq, rc = -ENOMEM);
+
+ snprintf(prefix, MAX_OBD_NAME + 5, "cli-%s", obd->obd_name);
+
+ /* Init client side sequence-manager */
+ rc = seq_client_init(cli->cl_seq, exp, type, prefix, NULL);
+ OBD_FREE(prefix, MAX_OBD_NAME + 5);
+ if (rc)
+ GOTO(out_free_seq, rc);
+
+ RETURN(rc);
+out_free_seq:
+ OBD_FREE_PTR(cli->cl_seq);
+ cli->cl_seq = NULL;
+ return rc;
+}
+EXPORT_SYMBOL(client_fid_init);
+
+int client_fid_fini(struct obd_device *obd)
+{
+ struct client_obd *cli = &obd->u.cli;
+ ENTRY;
+
+ if (cli->cl_seq != NULL) {
+ seq_client_fini(cli->cl_seq);
+ OBD_FREE_PTR(cli->cl_seq);
+ cli->cl_seq = NULL;
+ }
+
+ RETURN(0);
+}
+EXPORT_SYMBOL(client_fid_fini);
+
+#ifdef __KERNEL__
+struct proc_dir_entry *seq_type_proc_dir;
+
+static int __init fid_mod_init(void)
+{
+ seq_type_proc_dir = lprocfs_register(LUSTRE_SEQ_NAME,
+ proc_lustre_root,
+ NULL, NULL);
+ if (IS_ERR(seq_type_proc_dir))
+ return PTR_ERR(seq_type_proc_dir);
+
+# ifdef HAVE_SERVER_SUPPORT
+ fid_server_mod_init();
+# endif
+
+ return 0;
+}
+
+static void __exit fid_mod_exit(void)
+{
+# ifdef HAVE_SERVER_SUPPORT
+ fid_server_mod_exit();
+# endif
+
+ if (seq_type_proc_dir != NULL && !IS_ERR(seq_type_proc_dir)) {
+ lprocfs_remove(&seq_type_proc_dir);
+ seq_type_proc_dir = NULL;
+ }
+}
+
+MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
+MODULE_DESCRIPTION("Lustre FID Module");
+MODULE_LICENSE("GPL");
+
+cfs_module(fid, "0.1.0", fid_mod_init, fid_mod_exit);
+#endif /* __KERNEL__ */
#define DEBUG_SUBSYSTEM S_FID
-#ifdef __KERNEL__
-# include <libcfs/libcfs.h>
-# include <linux/module.h>
-#else /* __KERNEL__ */
-# include <liblustre.h>
-#endif
-
-#include <obd.h>
-#include <obd_class.h>
+#include <libcfs/libcfs.h>
#include <dt_object.h>
#include <md_object.h>
#include <obd_support.h>
-#include <lustre_req_layout.h>
+#include <lustre_capa.h>
#include <lustre_fid.h>
+#include <lustre_fld.h>
#include "fid_internal.h"
-#ifdef __KERNEL__
-
static struct lu_buf *seq_store_buf(struct seq_thread_info *info)
{
struct lu_buf *buf;
EXIT;
}
-#endif
#define DEBUG_SUBSYSTEM S_FID
-#ifdef __KERNEL__
-# include <libcfs/libcfs.h>
-# include <linux/module.h>
-#else /* __KERNEL__ */
-# include <liblustre.h>
-#endif
-
+#include <libcfs/libcfs.h>
+#include <linux/module.h>
#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_fid.h>
+#include <lprocfs_status.h>
#include "fid_internal.h"
#ifdef LPROCFS
RETURN(rc);
}
+#ifdef HAVE_SERVER_SUPPORT
/*
* Server side procfs stuff.
*/
RETURN(rc);
}
+struct lprocfs_vars seq_server_proc_list[] = {
+ { "space",
+ seq_server_proc_read_space, seq_server_proc_write_space, NULL },
+ { "width",
+ seq_server_proc_read_width, seq_server_proc_write_width, NULL },
+ { "server",
+ seq_server_proc_read_server, NULL, NULL },
+ { NULL }
+};
+#endif /* HAVE_SERVER_SUPPORT */
+
/* Client side procfs stuff */
static int
seq_client_proc_write_space(struct file *file, const char *buffer,
RETURN(rc);
}
-struct lprocfs_vars seq_server_proc_list[] = {
- { "space", seq_server_proc_read_space, seq_server_proc_write_space, NULL },
- { "width", seq_server_proc_read_width, seq_server_proc_write_width, NULL },
- { "server", seq_server_proc_read_server, NULL, NULL },
- { NULL }};
-
struct lprocfs_vars seq_client_proc_list[] = {
{ "space", seq_client_proc_read_space, seq_client_proc_write_space, NULL },
{ "width", seq_client_proc_read_width, seq_client_proc_write_width, NULL },
return cfs_hash_bd_extra_get(site->ls_obj_hash, &bd);
}
+static inline struct seq_server_site *lu_site2seq(const struct lu_site *s)
+{
+ return s->ld_seq_site;
+}
+
/** \name ctors
* Constructors/destructors.
* @{
* Author: Yury Umanets <umka@clusterfs.com>
*/
-#ifndef __LINUX_FID_H
-#define __LINUX_FID_H
+#ifndef __LUSTRE_FID_H
+#define __LUSTRE_FID_H
/** \defgroup fid fid
*
#include <libcfs/libcfs.h>
#include <lustre/lustre_idl.h>
-#include <lustre_req_layout.h>
-#include <lustre_mdt.h>
-#include <obd.h>
-
+struct lu_env;
struct lu_site;
struct lu_context;
+struct obd_device;
+struct obd_export;
/* Whole sequences space range and zero range definitions */
extern const struct lu_seq_range LUSTRE_SEQ_SPACE_RANGE;
fid->f_ver = 0;
}
+/* seq client type */
+enum lu_cli_type {
+ LUSTRE_SEQ_METADATA = 1,
+ LUSTRE_SEQ_DATA
+};
+
enum lu_mgr_type {
LUSTRE_SEQ_SERVER,
LUSTRE_SEQ_CONTROLLER
struct seq_server_site *lss_site;
};
+struct com_thread_info;
int seq_query(struct com_thread_info *info);
+
+struct ptlrpc_request;
int seq_handle(struct ptlrpc_request *req);
/* Server methods */
+
int seq_server_init(struct lu_server_seq *seq,
struct dt_device *dev,
const char *prefix,
int fid_is_local(const struct lu_env *env,
struct lu_site *site, const struct lu_fid *fid);
+enum lu_cli_type;
int client_fid_init(struct obd_device *obd, struct obd_export *exp,
enum lu_cli_type type);
int client_fid_fini(struct obd_device *obd);
/** @} fid */
-#endif /* __LINUX_FID_H */
+#endif /* __LUSTRE_FID_H */
return container_of0(o->mo_lu.lo_dev, struct md_device, md_lu_dev);
}
-static inline struct seq_server_site *lu_site2seq(const struct lu_site *s)
-{
- return s->ld_seq_site;
-}
-
static inline int md_device_init(struct md_device *md, struct lu_device_type *t)
{
return lu_device_init(&md->md_lu_dev, t);
#include <lu_ref.h>
#include <lustre_lib.h>
#include <lustre_export.h>
+#include <lustre_fid.h>
#include <lustre_fld.h>
#include <lustre_capa.h>
struct md_enqueue_info *minfo,
int rc);
-/* seq client type */
-enum lu_cli_type {
- LUSTRE_SEQ_METADATA = 1,
- LUSTRE_SEQ_DATA
-};
-
struct md_enqueue_info {
struct md_op_data mi_data;
struct lookup_intent mi_it;
#define DEBUG_SUBSYSTEM S_MDS
#include <obd_class.h>
+#include <md_object.h>
#include <lustre_fid.h>
#include <lustre_param.h>
#include <lustre_update.h>
#include <obd.h>
#include <obd_class.h>
#include <dt_object.h>
+#include <md_object.h>
#include <lustre_fid.h>
#include <obd_ost.h>
#include <lustre_capa.h>
#define _OSD_INTERNAL_H
#include <dt_object.h>
+#include <md_object.h>
#include <lustre_quota.h>
#include <sys/arc.h>
#include <obd.h>
#include <obd_class.h>
#include <dt_object.h>
+#include <md_object.h>
#include <lustre_fid.h>
/*