From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964774AbWFSPcm (ORCPT ); Mon, 19 Jun 2006 11:32:42 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932521AbWFSPbk (ORCPT ); Mon, 19 Jun 2006 11:31:40 -0400 Received: from thunk.org ([69.25.196.29]:7306 "EHLO thunker.thunk.org") by vger.kernel.org with ESMTP id S932520AbWFSPbP (ORCPT ); Mon, 19 Jun 2006 11:31:15 -0400 Message-Id: <20060619153110.075342000@candygram.thunk.org> References: <20060619152003.830437000@candygram.thunk.org> Date: Mon, 19 Jun 2006 11:20:09 -0400 To: linux-kernel@vger.kernel.org Subject: [RFC] [PATCH 6/8] inode-diet: Move i_cindex from struct inode to struct file Content-Disposition: inline; filename=inode-slim-6 From: Theodore Tso X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on thunker.thunk.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org 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" Index: linux-2.6.17/include/linux/fs.h =================================================================== --- linux-2.6.17.orig/include/linux/fs.h 2006-06-18 19:53:54.000000000 -0400 +++ linux-2.6.17/include/linux/fs.h 2006-06-18 19:59:59.000000000 -0400 @@ -513,7 +513,6 @@ struct block_device *i_bdev; struct cdev *i_cdev; }; - int i_cindex; __u32 i_generation; @@ -659,6 +658,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/fs/char_dev.c =================================================================== --- linux-2.6.17.orig/fs/char_dev.c 2006-06-18 19:37:14.000000000 -0400 +++ linux-2.6.17/fs/char_dev.c 2006-06-18 19:59:59.000000000 -0400 @@ -290,7 +290,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/drivers/ieee1394/ieee1394_core.h =================================================================== --- linux-2.6.17.orig/drivers/ieee1394/ieee1394_core.h 2006-06-18 19:37:13.000000000 -0400 +++ linux-2.6.17/drivers/ieee1394/ieee1394_core.h 2006-06-18 19:59:59.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; --