[PATCH] inode-diet: Move i_cdev into a union
authorTheodore Ts'o <tytso@mit.edu>
Wed, 27 Sep 2006 08:50:49 +0000 (01:50 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 27 Sep 2006 15:26:17 +0000 (08:26 -0700)
Move the i_cdev pointer in struct inode into a union.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/file_table.c
fs/inode.c
include/linux/fs.h

index 0131ba06e1ee48bc9714805efa8b15a11a21edcc..bc35a40417d7ada53223f5c93ed26875af97a646 100644 (file)
@@ -169,7 +169,7 @@ void fastcall __fput(struct file *file)
        if (file->f_op && file->f_op->release)
                file->f_op->release(inode, file);
        security_file_free(file);
-       if (unlikely(inode->i_cdev != NULL))
+       if (unlikely(S_ISCHR(inode->i_mode) && inode->i_cdev != NULL))
                cdev_put(inode->i_cdev);
        fops_put(file->f_op);
        if (file->f_mode & FMODE_WRITE)
index 41b462232f7f39638f033b52ce2f23f385f607db..f5c04dd9ae8ae54ba32ebfd4c8cba3bb4001f219 100644 (file)
@@ -256,7 +256,7 @@ void clear_inode(struct inode *inode)
                inode->i_sb->s_op->clear_inode(inode);
        if (S_ISBLK(inode->i_mode) && inode->i_bdev)
                bd_forget(inode);
-       if (inode->i_cdev)
+       if (S_ISCHR(inode->i_mode) && inode->i_cdev)
                cd_forget(inode);
        inode->i_state = I_CLEAR;
 }
index 98ff684a5b1cdaf4c67d177492d21c5a1e142b38..192e69bb55b5813182d1cd995f94146e8eeaf5d9 100644 (file)
@@ -532,8 +532,8 @@ struct inode {
        union {
                struct pipe_inode_info  *i_pipe;
                struct block_device     *i_bdev;
+               struct cdev             *i_cdev;
        };
-       struct cdev             *i_cdev;
        int                     i_cindex;
 
        __u32                   i_generation;