[patch 6/8] inode-diet: Move i_cindex from struct inode to struct file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



inode.i_cindex isn't initialized until the character device is opened
anyway, and there are far more struct inodes in memory than there are
struct file.  So move the cindex field to file.f_cindex, and change
the one(!) user of cindex to use file pointer, which is in fact simpler.

Signed-off-by: "Theodore Ts'o" <[email protected]>


Index: linux-2.6.17-mm5/include/linux/fs.h
===================================================================
--- linux-2.6.17-mm5.orig/include/linux/fs.h	2006-07-02 20:29:16.000000000 -0400
+++ linux-2.6.17-mm5/include/linux/fs.h	2006-07-02 20:29:49.000000000 -0400
@@ -528,7 +528,6 @@
 		struct block_device	*i_bdev;
 		struct cdev		*i_cdev;
 	};
-	int			i_cindex;
 
 	__u32			i_generation;
 
@@ -749,6 +748,7 @@
 	spinlock_t		f_ep_lock;
 #endif /* #ifdef CONFIG_EPOLL */
 	struct address_space	*f_mapping;
+	int			f_cindex;
 };
 extern spinlock_t files_lock;
 #define file_list_lock() spin_lock(&files_lock);
Index: linux-2.6.17-mm5/fs/char_dev.c
===================================================================
--- linux-2.6.17-mm5.orig/fs/char_dev.c	2006-07-02 20:25:46.000000000 -0400
+++ linux-2.6.17-mm5/fs/char_dev.c	2006-07-02 20:29:49.000000000 -0400
@@ -288,7 +288,7 @@
 		p = inode->i_cdev;
 		if (!p) {
 			inode->i_cdev = p = new;
-			inode->i_cindex = idx;
+			filp->f_cindex = idx;
 			list_add(&inode->i_devices, &p->list);
 			new = NULL;
 		} else if (!cdev_get(p))
Index: linux-2.6.17-mm5/drivers/ieee1394/ieee1394_core.h
===================================================================
--- linux-2.6.17-mm5.orig/drivers/ieee1394/ieee1394_core.h	2006-07-02 20:25:31.000000000 -0400
+++ linux-2.6.17-mm5/drivers/ieee1394/ieee1394_core.h	2006-07-02 20:29:49.000000000 -0400
@@ -212,7 +212,7 @@
 /* return the index (within a minor number block) of a file */
 static inline unsigned char ieee1394_file_to_instance(struct file *file)
 {
-	return file->f_dentry->d_inode->i_cindex;
+	return file->f_cindex;
 }
 
 extern int hpsb_disable_irm;

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux