diff options
author | Theodore Ts'o <tytso@mit.edu> | 2006-09-27 04:50:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-27 11:26:17 -0400 |
commit | 8e18e2941c53416aa219708e7dcad21fb4bd6794 (patch) | |
tree | 44118f8b09556193ac93e0b71aecfa3e1d4bc182 /drivers/infiniband | |
parent | 6a1d9805ec506d8b9d04450997707da5f643d87c (diff) |
[PATCH] inode_diet: Replace inode.u.generic_ip with inode.i_private
The following patches reduce the size of the VFS inode structure by 28 bytes
on a UP x86. (It would be more on an x86_64 system). This is a 10% reduction
in the inode size on a UP kernel that is configured in a production mode
(i.e., with no spinlock or other debugging functions enabled; if you want to
save memory taken up by in-core inodes, the first thing you should do is
disable the debugging options; they are responsible for a huge amount of bloat
in the VFS inode structure).
This patch:
The filesystem or device-specific pointer in the inode is inside a union,
which is pretty pointless given that all 30+ users of this field have been
using the void pointer. Get rid of the union and rename it to i_private, with
a comment to explain who is allowed to use the void pointer. This is just a
cleanup, but it allows us to reuse the union 'u' for something something where
the union will actually be used.
[judith@osdl.org: powerpc build fix]
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Judith Lebzelter <judith@osdl.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_fs.c | 12 | ||||
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_fs.c | 4 |
2 files changed, 8 insertions, 8 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c index a5eb30a06a5c..055cdd089b28 100644 --- a/drivers/infiniband/hw/ipath/ipath_fs.c +++ b/drivers/infiniband/hw/ipath/ipath_fs.c | |||
@@ -64,7 +64,7 @@ static int ipathfs_mknod(struct inode *dir, struct dentry *dentry, | |||
64 | inode->i_blksize = PAGE_CACHE_SIZE; | 64 | inode->i_blksize = PAGE_CACHE_SIZE; |
65 | inode->i_blocks = 0; | 65 | inode->i_blocks = 0; |
66 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | 66 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
67 | inode->u.generic_ip = data; | 67 | inode->i_private = data; |
68 | if ((mode & S_IFMT) == S_IFDIR) { | 68 | if ((mode & S_IFMT) == S_IFDIR) { |
69 | inode->i_op = &simple_dir_inode_operations; | 69 | inode->i_op = &simple_dir_inode_operations; |
70 | inode->i_nlink++; | 70 | inode->i_nlink++; |
@@ -119,7 +119,7 @@ static ssize_t atomic_counters_read(struct file *file, char __user *buf, | |||
119 | u16 i; | 119 | u16 i; |
120 | struct ipath_devdata *dd; | 120 | struct ipath_devdata *dd; |
121 | 121 | ||
122 | dd = file->f_dentry->d_inode->u.generic_ip; | 122 | dd = file->f_dentry->d_inode->i_private; |
123 | 123 | ||
124 | for (i = 0; i < NUM_COUNTERS; i++) | 124 | for (i = 0; i < NUM_COUNTERS; i++) |
125 | counters[i] = ipath_snap_cntr(dd, i); | 125 | counters[i] = ipath_snap_cntr(dd, i); |
@@ -139,7 +139,7 @@ static ssize_t atomic_node_info_read(struct file *file, char __user *buf, | |||
139 | struct ipath_devdata *dd; | 139 | struct ipath_devdata *dd; |
140 | u64 guid; | 140 | u64 guid; |
141 | 141 | ||
142 | dd = file->f_dentry->d_inode->u.generic_ip; | 142 | dd = file->f_dentry->d_inode->i_private; |
143 | 143 | ||
144 | guid = be64_to_cpu(dd->ipath_guid); | 144 | guid = be64_to_cpu(dd->ipath_guid); |
145 | 145 | ||
@@ -178,7 +178,7 @@ static ssize_t atomic_port_info_read(struct file *file, char __user *buf, | |||
178 | u32 tmp, tmp2; | 178 | u32 tmp, tmp2; |
179 | struct ipath_devdata *dd; | 179 | struct ipath_devdata *dd; |
180 | 180 | ||
181 | dd = file->f_dentry->d_inode->u.generic_ip; | 181 | dd = file->f_dentry->d_inode->i_private; |
182 | 182 | ||
183 | /* so we only initialize non-zero fields. */ | 183 | /* so we only initialize non-zero fields. */ |
184 | memset(portinfo, 0, sizeof portinfo); | 184 | memset(portinfo, 0, sizeof portinfo); |
@@ -325,7 +325,7 @@ static ssize_t flash_read(struct file *file, char __user *buf, | |||
325 | goto bail; | 325 | goto bail; |
326 | } | 326 | } |
327 | 327 | ||
328 | dd = file->f_dentry->d_inode->u.generic_ip; | 328 | dd = file->f_dentry->d_inode->i_private; |
329 | if (ipath_eeprom_read(dd, pos, tmp, count)) { | 329 | if (ipath_eeprom_read(dd, pos, tmp, count)) { |
330 | ipath_dev_err(dd, "failed to read from flash\n"); | 330 | ipath_dev_err(dd, "failed to read from flash\n"); |
331 | ret = -ENXIO; | 331 | ret = -ENXIO; |
@@ -381,7 +381,7 @@ static ssize_t flash_write(struct file *file, const char __user *buf, | |||
381 | goto bail_tmp; | 381 | goto bail_tmp; |
382 | } | 382 | } |
383 | 383 | ||
384 | dd = file->f_dentry->d_inode->u.generic_ip; | 384 | dd = file->f_dentry->d_inode->i_private; |
385 | if (ipath_eeprom_write(dd, pos, tmp, count)) { | 385 | if (ipath_eeprom_write(dd, pos, tmp, count)) { |
386 | ret = -ENXIO; | 386 | ret = -ENXIO; |
387 | ipath_dev_err(dd, "failed to write to flash\n"); | 387 | ipath_dev_err(dd, "failed to write to flash\n"); |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_fs.c b/drivers/infiniband/ulp/ipoib/ipoib_fs.c index 5dde380e8dbe..f1cb83688b31 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_fs.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_fs.c | |||
@@ -141,7 +141,7 @@ static int ipoib_mcg_open(struct inode *inode, struct file *file) | |||
141 | return ret; | 141 | return ret; |
142 | 142 | ||
143 | seq = file->private_data; | 143 | seq = file->private_data; |
144 | seq->private = inode->u.generic_ip; | 144 | seq->private = inode->i_private; |
145 | 145 | ||
146 | return 0; | 146 | return 0; |
147 | } | 147 | } |
@@ -247,7 +247,7 @@ static int ipoib_path_open(struct inode *inode, struct file *file) | |||
247 | return ret; | 247 | return ret; |
248 | 248 | ||
249 | seq = file->private_data; | 249 | seq = file->private_data; |
250 | seq->private = inode->u.generic_ip; | 250 | seq->private = inode->i_private; |
251 | 251 | ||
252 | return 0; | 252 | return 0; |
253 | } | 253 | } |