* Use is subject to license terms.
*/
/*
- * Copyright (c) 2012, Intel Corporation.
+ * Copyright (c) 2012, 2013, Intel Corporation.
* Use is subject to license terms.
*/
/*
* Author: Mike Pershin <tappro@whamcloud.com>
*/
-#ifndef EXPORT_SYMTAB
-# define EXPORT_SYMTAB
-#endif
#define DEBUG_SUBSYSTEM S_OSD
#include <lustre_ver.h>
#include <libcfs/libcfs.h>
-#include <lustre_fsfilt.h>
#include <obd_support.h>
#include <lustre_net.h>
#include <obd.h>
lu_object_put(env, &obj->oo_dt.do_lu);
}
-static int osd_remote_fid(const struct lu_env *env, struct osd_device *osd,
- struct lu_fid *fid)
+static int osd_mdt_seq_exists(const struct lu_env *env, struct osd_device *osd,
+ obd_seq seq)
{
struct lu_seq_range *range = &osd_oti_get(env)->oti_seq_range;
struct seq_server_site *ss = osd_seq_site(osd);
int rc;
ENTRY;
- if (!fid_is_norm(fid) && !fid_is_root(fid))
- RETURN(0);
+ if (ss == NULL)
+ RETURN(1);
- rc = osd_fld_lookup(env, osd, fid, range);
+ /* XXX: currently, each MDT only store avaible sequence on disk,
+ * and no allocated sequences information on disk, so it has to
+ * lookup FLDB. It probably makes more sense also store allocated
+ * sequence locally, so we do not need do remote FLDB lookup in OSD */
+ rc = osd_fld_lookup(env, osd, seq, range);
if (rc != 0) {
- CERROR("%s: Can not lookup fld for "DFID"\n",
- osd_name(osd), PFID(fid));
- RETURN(rc);
+ CERROR("%s: Can not lookup fld for "LPX64"\n",
+ osd_name(osd), seq);
+ RETURN(0);
}
- RETURN(ss->ss_node_id != range->lsr_index);
+ RETURN(ss->ss_node_id == range->lsr_index);
+}
+
+static int osd_remote_fid(const struct lu_env *env, struct osd_device *osd,
+ struct lu_fid *fid)
+{
+ ENTRY;
+
+ if (!fid_is_norm(fid) && !fid_is_root(fid))
+ RETURN(0);
+
+ /* Currently, it only used to check FID on MDT */
+ if (osd_mdt_seq_exists(env, osd, fid_seq(fid)))
+ RETURN(0);
+
+ RETURN(1);
}
/**
if (IS_ERR(child))
RETURN(PTR_ERR(child));
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 3, 91, 0)
-#define OSD_ZFS_INSERT_DOTS_FOR_TESTING__
-#endif
LASSERT(child->oo_db);
if (name[0] == '.') {
if (name[1] == 0) {
/* do not store ".", instead generate it
* during iteration */
-#ifndef OSD_ZFS_INSERT_DOTS_FOR_TESTING
GOTO(out, rc = 0);
-#endif
} else if (name[1] == '.' && name[2] == 0) {
/* update parent dnode in the child.
* later it will be used to generate ".." */
udmu_objset_t *uos = &osd->od_objset;
- rc = osd_object_sa_update(parent, SA_ZPL_PARENT(uos),
- &child->oo_db->db_object,
- 8, oh);
-#ifndef OSD_ZFS_INSERT_DOTS_FOR_TESTING
+ rc = osd_object_sa_update(parent,
+ SA_ZPL_PARENT(uos),
+ &child->oo_db->db_object,
+ 8, oh);
GOTO(out, rc);
-#endif
}
}
CLASSERT(sizeof(oti->oti_zde.lzd_reg) == 8);
(char *)key, 8, sizeof(oti->oti_zde) / 8,
(void *)&oti->oti_zde, oh->ot_tx);
-#ifndef OSD_ZFS_INSERT_DOTS_FOR_TESTING
out:
-#endif
if (child != NULL)
osd_object_put(env, child);
LASSERT(th != NULL);
oh = container_of0(th, struct osd_thandle, ot_super);
-#ifndef OSD_ZFS_INSERT_DOTS_FOR_TESTING
/*
- * in Orion . and .. were stored in the directory (not generated up on
- * request as now. we preserve them for backward compatibility
+ * In Orion . and .. were stored in the directory (not generated upon
+ * request as now). we preserve them for backward compatibility
*/
if (name[0] == '.') {
if (name[1] == 0) {
RETURN(0);
}
}
-#endif
/* Remove key from the ZAP */
rc = -zap_remove(osd->od_objset.os, zap_db->db_object,
strcpy(it->ozi_name, za->za_name);
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 3, 91, 0)
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 3, 90, 0)
if (za->za_name[0] == '.') {
if (za->za_name[1] == 0 || (za->za_name[1] == '.' &&
za->za_name[2] == 0)) {
if ((rc = -zap_cursor_retrieve(it->ozi_zc, za)) == 0)
rc = strlen(za->za_name);
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 3, 99, 0)
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 3, 90, 0)
if (rc == 0 && za->za_name[0] == '.') {
if (za->za_name[1] == 0 || (za->za_name[1] == '.' &&
za->za_name[2] == 0)) {
int rc;
ENTRY;
- if (it->ozi_pos != 0) {
- /* the cursor wasn't at the beginning
- * so we should reset ZAP cursor as well */
- udmu_zap_cursor_fini(it->ozi_zc);
- if (udmu_zap_cursor_init(&it->ozi_zc, &osd->od_objset,
- obj->oo_db->db_object, hash))
- RETURN(-ENOMEM);
- }
+ udmu_zap_cursor_fini(it->ozi_zc);
+ if (udmu_zap_cursor_init(&it->ozi_zc, &osd->od_objset,
+ obj->oo_db->db_object, hash))
+ RETURN(-ENOMEM);
if (hash <= 2) {
it->ozi_pos = hash;