]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - fs/inode.c
const: mark remaining inode_operations as const
[net-next-2.6.git] / fs / inode.c
index ae7b67e48661b0f078679a67d6f0c1d40847bf06..f5ff71cb3e2b3bcd1ba92512022c41f2f9571208 100644 (file)
@@ -123,7 +123,7 @@ static void wake_up_inode(struct inode *inode)
 int inode_init_always(struct super_block *sb, struct inode *inode)
 {
        static const struct address_space_operations empty_aops;
-       static struct inode_operations empty_iops;
+       static const struct inode_operations empty_iops;
        static const struct file_operations empty_fops;
        struct address_space *const mapping = &inode->i_data;
 
@@ -182,9 +182,7 @@ int inode_init_always(struct super_block *sb, struct inode *inode)
        if (sb->s_bdev) {
                struct backing_dev_info *bdi;
 
-               bdi = sb->s_bdev->bd_inode_backing_dev_info;
-               if (!bdi)
-                       bdi = sb->s_bdev->bd_inode->i_mapping->backing_dev_info;
+               bdi = sb->s_bdev->bd_inode->i_mapping->backing_dev_info;
                mapping->backing_dev_info = bdi;
        }
        inode->i_private = NULL;
@@ -697,13 +695,15 @@ void unlock_new_inode(struct inode *inode)
        }
 #endif
        /*
-        * This is special!  We do not need the spinlock
-        * when clearing I_LOCK, because we're guaranteed
-        * that nobody else tries to do anything about the
-        * state of the inode when it is locked, as we
-        * just created it (so there can be no old holders
-        * that haven't tested I_LOCK).
+        * This is special!  We do not need the spinlock when clearing I_LOCK,
+        * because we're guaranteed that nobody else tries to do anything about
+        * the state of the inode when it is locked, as we just created it (so
+        * there can be no old holders that haven't tested I_LOCK).
+        * However we must emit the memory barrier so that other CPUs reliably
+        * see the clearing of I_LOCK after the other inode initialisation has
+        * completed.
         */
+       smp_mb();
        WARN_ON((inode->i_state & (I_LOCK|I_NEW)) != (I_LOCK|I_NEW));
        inode->i_state &= ~(I_LOCK|I_NEW);
        wake_up_inode(inode);