Unionfs: Remove superfluous check for NULL pointer
authorErez_Zadok <ezk@cs.sunysb.edu>
Fri, 16 Nov 2007 18:47:22 +0000 (13:47 -0500)
committerRachita Kothiyal <rachita@dewey.fsl.cs.sunysb.edu>
Thu, 1 May 2008 23:02:55 +0000 (19:02 -0400)
Since we use containers and the struct inode is _inside_ the
unionfs_inode_info structure, UNIONFS_I will always (given a non-NULL inode
pointer), return a valid non-NULL pointer.

Signed-off-by: Josef 'Jeff' Sipek <jsipek@cs.sunysb.edu>
Conflicts:

fs/unionfs/super.c

fs/unionfs/fanout.h
fs/unionfs/super.c

index e40d7fbe56c0d3bab7db9f247d2e97bfe5c0849b..f6393ea423a9539e530a737ee89d2d52249c55e4 100644 (file)
 #ifndef _FANOUT_H_
 #define _FANOUT_H_
 
-/* Inode to private data */
+/*
+ * Inode to private data
+ *
+ * Since we use containers and the struct inode is _inside_ the
+ * unionfs_inode_info structure, UNIONFS_I will always (given a non-NULL
+ * inode pointer), return a valid non-NULL pointer.
+ */
 static inline struct unionfs_inode_info *UNIONFS_I(const struct inode *inode)
 {
        return container_of(inode, struct unionfs_inode_info, vfs_inode);
index bb0f9d4b0ad3e9ede1b9ae0aa9f339d14430b513..3f0ffae17783aaee0487c060973cc439af417ac9 100644 (file)
@@ -30,11 +30,7 @@ static void unionfs_read_inode(struct inode *inode)
        int size;
        struct unionfs_inode_info *info = UNIONFS_I(inode);
 
-       if (!info) {
-               printk(KERN_ERR "unionfs: no kernel memory when allocating "
-                      "inode private data!\n");
-               BUG();
-       }
+       unionfs_read_lock(inode->i_sb);
 
        memset(info, 0, offsetof(struct unionfs_inode_info, vfs_inode));
        info->bstart = -1;
@@ -57,6 +53,8 @@ static void unionfs_read_inode(struct inode *inode)
        inode->i_fop = &unionfs_main_fops;
 
        inode->i_mapping->a_ops = &unionfs_aops;
+
+       unionfs_read_unlock(inode->i_sb);
 }
 
 /*