{
int rc = 0;
ENTRY;
-
+
fld_cache = fld_cache_init(FLD_HTABLE_SIZE);
if (IS_ERR(fld_cache))
rc = PTR_ERR(fld_cache);
if (rc != 0)
fld_cache = NULL;
-
+
RETURN(rc);
}
{
int rc;
ENTRY;
-
+
rc = fld_index_create(fld, ctx, seq, mds);
if (rc == 0) {
/* do not return result of calling fld_cache_insert()
struct fld_cache_entry *flde;
int rc;
ENTRY;
-
+
/* lookup it in the cache first */
flde = fld_cache_lookup(fld_cache, seq);
if (flde != NULL) {
} else {
CERROR("cannot unpack FLD operation\n");
}
-
+
out_pill:
EXIT;
req_capsule_fini(&pill);
return 0;
}
+/*
+ * Returns true, if fid is local to this server node.
+ *
+ * WARNING: this function is *not* guaranteed to return false if fid is
+ * remote: it makes an educated conservative guess only.
+ *
+ * fid_is_local() is supposed to be used in assertion checks only.
+ */
+int fid_is_local(struct lu_site *site, const struct lu_fid *fid)
+{
+ int result;
+
+ result = 1; /* conservatively assume fid is local */
+ if (site->ls_fld != NULL) {
+ struct fld_cache_entry *entry;
+
+ entry = fld_cache_lookup(fld_cache, fid_seq(fid));
+ if (entry != NULL)
+ result = (entry->fce_mds == site->ls_node_id);
+ }
+ return result;
+}
+EXPORT_SYMBOL(fid_is_local);
+
#ifdef LPROCFS
static int
fld_server_proc_init(struct lu_server_fld *fld)
snprintf(fld->fld_name, sizeof(fld->fld_name),
"%s-%s", LUSTRE_FLD_NAME, uuid);
-
+
rc = fld_index_init(fld, ctx);
if (rc)
GOTO(out, rc);
#ifdef LPROCFS
fld_server_proc_fini(fld);
#endif
-
+
if (fld->fld_service != NULL) {
ptlrpc_unregister_service(fld->fld_service);
fld->fld_service = NULL;
struct lu_device *, struct lustre_cfg *);
/*
- * notify function for metadata stack
+ * notify function for metadata stack
*/
int (*ldo_notify)(const struct lu_context *ctx, struct lu_device *d,
struct obd_device *watched, enum obd_notify_event ev,
* Top-level device for this stack.
*/
struct lu_device *ls_top_dev;
- /* current server index */
- __u32 ls_node_id;
+ /*
+ * mds number of this site.
+ */
+ mdsno_t ls_node_id;
/*
* Fid location database
*/
result = 1;
return result;
}
-
+
static inline int lu_object_assert_not_exists(const struct lu_context *ctx,
const struct lu_object *o)
{
/* super-sequence range, all super-sequences for other servers are
* allocated from it. */
struct lu_range seq_super;
-
+
/* device for server side seq manager needs (saving sequences to backing
* store). */
struct dt_device *seq_dev;
void seq_server_fini_ctlr(struct lu_server_seq *seq);
#endif
-int seq_client_init(struct lu_client_seq *seq,
+int seq_client_init(struct lu_client_seq *seq,
const char *uuid,
struct obd_export *exp);
struct lu_fid *fid);
/* Fids common stuff */
-static inline int fid_is_local(const struct lu_context *ctx,
- struct lu_site *site,
- const struct lu_fid *fid)
-{
- mdsno_t mds;
-
- if (site->ls_fld == NULL)
- return 1;
-
- /* XXX: this function checks also on-disk index, so it can't be used
- * with spinlocks taken. --umka */
- rc = fld_server_lookup(site->ls_fld, ctx,
- fid_seq(fid), *mds);
- if (rc) {
- CERROR("can't lookup FLD for seq "LPU64", rc %d. "
- "Considering local fid anyway\n", fid_seq(fid),
- rc);
- return 1;
- }
-
- return (mds == ls_node_id);
-}
-
+int fid_is_local(struct lu_site *site, const struct lu_fid *fid);
void fid_to_le(struct lu_fid *dst, const struct lu_fid *src);
#endif /* __LINUX_OBD_CLASS_H */