#define btrfs_debug_check_extent_io_range(c, s, e)     do {} while (0)
 #endif
 
-/*
- * For the file_extent_tree, we want to hold the inode lock when we lookup and
- * update the disk_i_size, but lockdep will complain because our io_tree we hold
- * the tree lock and get the inode lock when setting delalloc.  These two things
- * are unrelated, so make a class for the file_extent_tree so we don't get the
- * two locking patterns mixed up.
- */
-static struct lock_class_key file_extent_tree_class;
 
 void extent_io_tree_init(struct btrfs_fs_info *fs_info,
                         struct extent_io_tree *tree, unsigned int owner)
        spin_lock_init(&tree->lock);
        tree->inode = NULL;
        tree->owner = owner;
-       if (owner == IO_TREE_INODE_FILE_EXTENT)
-               lockdep_set_class(&tree->lock, &file_extent_tree_class);
 }
 
 /*
 
        int mirror_num;
 };
 
+/*
+ * For the file_extent_tree, we want to hold the inode lock when we lookup and
+ * update the disk_i_size, but lockdep will complain because our io_tree we hold
+ * the tree lock and get the inode lock when setting delalloc. These two things
+ * are unrelated, so make a class for the file_extent_tree so we don't get the
+ * two locking patterns mixed up.
+ */
+static struct lock_class_key file_extent_tree_class;
+
 static const struct inode_operations btrfs_dir_inode_operations;
 static const struct inode_operations btrfs_symlink_inode_operations;
 static const struct inode_operations btrfs_special_inode_operations;
        ei->io_tree.inode = ei;
        extent_io_tree_init(fs_info, &ei->file_extent_tree,
                            IO_TREE_INODE_FILE_EXTENT);
+       /* Lockdep class is set only for the file extent tree. */
+       lockdep_set_class(&ei->file_extent_tree.lock, &file_extent_tree_class);
        mutex_init(&ei->log_mutex);
        spin_lock_init(&ei->ordered_tree_lock);
        ei->ordered_tree = RB_ROOT;