ALSA: hda - iMac9,1 sound fixes
[safe/jmp/linux-2.6] / fs / ocfs2 / sysfile.c
index fc29cb7..bfe7190 100644 (file)
 
 #include <linux/fs.h>
 #include <linux/types.h>
-#include <linux/slab.h>
 #include <linux/highmem.h>
 
-#include "ocfs2.h"
-
 #define MLOG_MASK_PREFIX ML_INODE
 #include <cluster/masklog.h>
 
+#include "ocfs2.h"
+
 #include "alloc.h"
 #include "dir.h"
 #include "inode.h"
@@ -50,6 +49,10 @@ static inline int is_in_system_inode_array(struct ocfs2_super *osb,
                                           int type,
                                           u32 slot);
 
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+static struct lock_class_key ocfs2_sysfile_cluster_lock_key[NUM_SYSTEM_INODES];
+#endif
+
 static inline int is_global_system_inode(int type)
 {
        return type >= OCFS2_FIRST_ONLINE_SYSTEM_INODE &&
@@ -100,30 +103,41 @@ static struct inode * _ocfs2_get_system_file_inode(struct ocfs2_super *osb,
        char namebuf[40];
        struct inode *inode = NULL;
        u64 blkno;
-       struct buffer_head *dirent_bh = NULL;
-       struct ocfs2_dir_entry *de = NULL;
        int status = 0;
 
        ocfs2_sprintf_system_inode_name(namebuf,
                                        sizeof(namebuf),
                                        type, slot);
 
-       status = ocfs2_find_files_on_disk(namebuf, strlen(namebuf),
-                                         &blkno, osb->sys_root_inode,
-                                         &dirent_bh, &de);
+       status = ocfs2_lookup_ino_from_name(osb->sys_root_inode, namebuf,
+                                           strlen(namebuf), &blkno);
        if (status < 0) {
                goto bail;
        }
 
-       inode = ocfs2_iget(osb, blkno);
+       inode = ocfs2_iget(osb, blkno, OCFS2_FI_FLAG_SYSFILE, type);
        if (IS_ERR(inode)) {
                mlog_errno(PTR_ERR(inode));
                inode = NULL;
                goto bail;
        }
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+       if (type == LOCAL_USER_QUOTA_SYSTEM_INODE ||
+           type == LOCAL_GROUP_QUOTA_SYSTEM_INODE ||
+           type == JOURNAL_SYSTEM_INODE) {
+               /* Ignore inode lock on these inodes as the lock does not
+                * really belong to any process and lockdep cannot handle
+                * that */
+               OCFS2_I(inode)->ip_inode_lockres.l_lockdep_map.key = NULL;
+       } else {
+               lockdep_init_map(&OCFS2_I(inode)->ip_inode_lockres.
+                                                               l_lockdep_map,
+                                ocfs2_system_inodes[type].si_name,
+                                &ocfs2_sysfile_cluster_lock_key[type], 0);
+       }
+#endif
 bail:
-       if (dirent_bh)
-               brelse(dirent_bh);
+
        return inode;
 }