Whamcloud - gitweb
LU-598 open non-exist object should return ENOENT
[fs/lustre-release.git] / lustre / mdd / mdd_orphans.c
index c9dff6d..8c9a994 100644 (file)
@@ -26,7 +26,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  */
 /*
@@ -70,7 +70,8 @@ static struct dt_key* orph_key_fill(const struct lu_env *env,
         int rc;
 
         LASSERT(key);
-        rc = snprintf(key, NAME_MAX + 1, ORPHAN_FILE_NAME_FORMAT, fid_seq(lf),
+        rc = snprintf(key, NAME_MAX + 1, ORPHAN_FILE_NAME_FORMAT,
+                      (long long unsigned int)fid_seq(lf),
                       fid_oid(lf), fid_ver(lf), op);
         if (rc > 0)
                 return (struct dt_key*) key;
@@ -85,8 +86,8 @@ static struct dt_key* orph_key_fill_18(const struct lu_env *env,
         int rc;
 
         LASSERT(key);
-        rc = snprintf(key, NAME_MAX + 1, ORPHAN_FILE_NAME_FORMAT_18, fid_seq(lf),
-                      fid_oid(lf));
+        rc = snprintf(key, NAME_MAX + 1, ORPHAN_FILE_NAME_FORMAT_18,
+                      (unsigned long long)fid_seq(lf), fid_oid(lf));
         if (rc > 0)
                 return (struct dt_key*) key;
         else
@@ -98,14 +99,15 @@ static int orphan_key_to_fid(char *key, struct lu_fid *lf)
         int rc = 0;
         unsigned int op;
 
-        rc = sscanf(key, ORPHAN_FILE_NAME_FORMAT, &lf->f_seq, &lf->f_oid,
+        rc = sscanf(key, ORPHAN_FILE_NAME_FORMAT,
+                    (long long unsigned int *)&lf->f_seq, &lf->f_oid,
                     &lf->f_ver, &op);
         if (rc == 4)
                 return 0;
 
         /* build igif */
         rc = sscanf(key, ORPHAN_FILE_NAME_FORMAT_18,
-                    &lf->f_seq, &lf->f_oid);
+                    (long long unsigned int *)&lf->f_seq, &lf->f_oid);
         if (rc == 2) {
                 lf->f_ver = 0;
                 return 0;
@@ -388,8 +390,8 @@ static int orph_index_iterate(const struct lu_env *env,
         /* In recovery phase, do not need for any lock here */
 
         iops = &dor->do_index_ops->dio_it;
-        it = iops->init(env, dor, BYPASS_CAPA);
-        if (it != NULL) {
+        it = iops->init(env, dor, LUDA_64BITHASH, BYPASS_CAPA);
+        if (!IS_ERR(it)) {
                 result = iops->load(env, it, 0);
                 if (result > 0) {
                         /* main cycle */
@@ -441,8 +443,8 @@ next:
                 iops->put(env, it);
                 iops->fini(env, it);
         } else {
-                CERROR("not enough memory for clean pending.\n");
-                result = -ENOMEM;
+                result = PTR_ERR(it);
+                CERROR("Cannot clean pending (%d).\n", result);
         }
 
         RETURN(result);