Whamcloud - gitweb
LU-8837 lmv: don't use lqr_alloc spinlock in lmv
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_iam.c
index bc58329..96d8b47 100644 (file)
 
 #include <ldiskfs/acl.h>
 
-/*
- * List of all registered formats.
- *
- * No locking. Callers synchronize.
- */
-static LIST_HEAD(iam_formats);
-
-void iam_format_register(struct iam_format *fmt)
-{
-       list_add(&fmt->if_linkage, &iam_formats);
-}
-
 static struct buffer_head *
 iam_load_idle_blocks(struct iam_container *c, iam_ptr_t blk)
 {
@@ -178,7 +166,7 @@ iam_load_idle_blocks(struct iam_container *c, iam_ptr_t blk)
 
        bh = __ldiskfs_bread(NULL, inode, blk, 0);
        if (IS_ERR_OR_NULL(bh)) {
-               CERROR("%s: cannot load idle blocks, blk = %u, err = %ld\n",
+               CERROR("%s: cannot load idle blocks, blk = %u: rc = %ld\n",
                       osd_ino2name(inode), blk, bh ? PTR_ERR(bh) : -EIO);
                c->ic_idle_failed = 1;
                if (bh == NULL)
@@ -188,11 +176,14 @@ iam_load_idle_blocks(struct iam_container *c, iam_ptr_t blk)
 
        head = (struct iam_idle_head *)(bh->b_data);
        if (le16_to_cpu(head->iih_magic) != IAM_IDLE_HEADER_MAGIC) {
-               CERROR("%s: invalid idle block head, blk = %u, magic = %d\n",
-                      osd_ino2name(inode), blk, le16_to_cpu(head->iih_magic));
+               int rc = -EBADF;
+
+               CERROR("%s: invalid idle block head, blk = %u, magic = %x: rc = %d\n",
+                      osd_ino2name(inode), blk, le16_to_cpu(head->iih_magic),
+                      rc);
                brelse(bh);
                c->ic_idle_failed = 1;
-               return ERR_PTR(-EBADF);
+               return ERR_PTR(rc);
        }
 
        return bh;
@@ -205,27 +196,10 @@ iam_load_idle_blocks(struct iam_container *c, iam_ptr_t blk)
 static int iam_format_guess(struct iam_container *c)
 {
        int result;
-       struct iam_format *fmt;
-
-       /*
-        * XXX temporary initialization hook.
-        */
-       {
-               static int initialized = 0;
 
-               if (!initialized) {
-                       iam_lvar_format_init();
-                       iam_lfix_format_init();
-                       initialized = 1;
-               }
-       }
-
-       result = -ENOENT;
-       list_for_each_entry(fmt, &iam_formats, if_linkage) {
-               result = fmt->if_guess(c);
-               if (result == 0)
-                       break;
-       }
+       result = iam_lvar_guess(c);
+       if (result)
+               result = iam_lfix_guess(c);
 
        if (result == 0) {
                struct buffer_head *bh;
@@ -422,8 +396,6 @@ static int iam_leaf_keyeq(const struct iam_leaf *leaf,
 }
 
 #if LDISKFS_INVARIANT_ON
-extern int dx_node_check(struct iam_path *p, struct iam_frame *f);
-
 static int iam_path_check(struct iam_path *p)
 {
        int i;