aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2006-09-27 04:50:46 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-27 11:26:17 -0400
commit8e18e2941c53416aa219708e7dcad21fb4bd6794 (patch)
tree44118f8b09556193ac93e0b71aecfa3e1d4bc182 /fs/jffs
parent6a1d9805ec506d8b9d04450997707da5f643d87c (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 'fs/jffs')
-rw-r--r--fs/jffs/inode-v23.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/fs/jffs/inode-v23.c b/fs/jffs/inode-v23.c
index b59553d28d13..7358ef87f16b 100644
--- a/fs/jffs/inode-v23.c
+++ b/fs/jffs/inode-v23.c
@@ -369,7 +369,7 @@ jffs_new_inode(const struct inode * dir, struct jffs_raw_inode *raw_inode,
369 369
370 f = jffs_find_file(c, raw_inode->ino); 370 f = jffs_find_file(c, raw_inode->ino);
371 371
372 inode->u.generic_ip = (void *)f; 372 inode->i_private = (void *)f;
373 insert_inode_hash(inode); 373 insert_inode_hash(inode);
374 374
375 return inode; 375 return inode;
@@ -442,7 +442,7 @@ jffs_rename(struct inode *old_dir, struct dentry *old_dentry,
442 }); 442 });
443 443
444 result = -ENOTDIR; 444 result = -ENOTDIR;
445 if (!(old_dir_f = (struct jffs_file *)old_dir->u.generic_ip)) { 445 if (!(old_dir_f = old_dir->i_private)) {
446 D(printk("jffs_rename(): Old dir invalid.\n")); 446 D(printk("jffs_rename(): Old dir invalid.\n"));
447 goto jffs_rename_end; 447 goto jffs_rename_end;
448 } 448 }
@@ -456,7 +456,7 @@ jffs_rename(struct inode *old_dir, struct dentry *old_dentry,
456 456
457 /* Find the new directory. */ 457 /* Find the new directory. */
458 result = -ENOTDIR; 458 result = -ENOTDIR;
459 if (!(new_dir_f = (struct jffs_file *)new_dir->u.generic_ip)) { 459 if (!(new_dir_f = new_dir->i_private)) {
460 D(printk("jffs_rename(): New dir invalid.\n")); 460 D(printk("jffs_rename(): New dir invalid.\n"));
461 goto jffs_rename_end; 461 goto jffs_rename_end;
462 } 462 }
@@ -593,7 +593,7 @@ jffs_readdir(struct file *filp, void *dirent, filldir_t filldir)
593 } 593 }
594 else { 594 else {
595 ddino = ((struct jffs_file *) 595 ddino = ((struct jffs_file *)
596 inode->u.generic_ip)->pino; 596 inode->i_private)->pino;
597 } 597 }
598 D3(printk("jffs_readdir(): \"..\" %u\n", ddino)); 598 D3(printk("jffs_readdir(): \"..\" %u\n", ddino));
599 if (filldir(dirent, "..", 2, filp->f_pos, ddino, DT_DIR) < 0) { 599 if (filldir(dirent, "..", 2, filp->f_pos, ddino, DT_DIR) < 0) {
@@ -604,7 +604,7 @@ jffs_readdir(struct file *filp, void *dirent, filldir_t filldir)
604 } 604 }
605 filp->f_pos++; 605 filp->f_pos++;
606 } 606 }
607 f = ((struct jffs_file *)inode->u.generic_ip)->children; 607 f = ((struct jffs_file *)inode->i_private)->children;
608 608
609 j = 2; 609 j = 2;
610 while(f && (f->deleted || j++ < filp->f_pos )) { 610 while(f && (f->deleted || j++ < filp->f_pos )) {
@@ -668,7 +668,7 @@ jffs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
668 } 668 }
669 669
670 r = -EACCES; 670 r = -EACCES;
671 if (!(d = (struct jffs_file *)dir->u.generic_ip)) { 671 if (!(d = (struct jffs_file *)dir->i_private)) {
672 D(printk("jffs_lookup(): No such inode! (%lu)\n", 672 D(printk("jffs_lookup(): No such inode! (%lu)\n",
673 dir->i_ino)); 673 dir->i_ino));
674 goto jffs_lookup_end; 674 goto jffs_lookup_end;
@@ -739,7 +739,7 @@ jffs_do_readpage_nolock(struct file *file, struct page *page)
739 unsigned long read_len; 739 unsigned long read_len;
740 int result; 740 int result;
741 struct inode *inode = (struct inode*)page->mapping->host; 741 struct inode *inode = (struct inode*)page->mapping->host;
742 struct jffs_file *f = (struct jffs_file *)inode->u.generic_ip; 742 struct jffs_file *f = (struct jffs_file *)inode->i_private;
743 struct jffs_control *c = (struct jffs_control *)inode->i_sb->s_fs_info; 743 struct jffs_control *c = (struct jffs_control *)inode->i_sb->s_fs_info;
744 int r; 744 int r;
745 loff_t offset; 745 loff_t offset;
@@ -828,7 +828,7 @@ jffs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
828 }); 828 });
829 829
830 lock_kernel(); 830 lock_kernel();
831 dir_f = (struct jffs_file *)dir->u.generic_ip; 831 dir_f = dir->i_private;
832 832
833 ASSERT(if (!dir_f) { 833 ASSERT(if (!dir_f) {
834 printk(KERN_ERR "jffs_mkdir(): No reference to a " 834 printk(KERN_ERR "jffs_mkdir(): No reference to a "
@@ -972,7 +972,7 @@ jffs_remove(struct inode *dir, struct dentry *dentry, int type)
972 kfree(_name); 972 kfree(_name);
973 }); 973 });
974 974
975 dir_f = (struct jffs_file *) dir->u.generic_ip; 975 dir_f = dir->i_private;
976 c = dir_f->c; 976 c = dir_f->c;
977 977
978 result = -ENOENT; 978 result = -ENOENT;
@@ -1082,7 +1082,7 @@ jffs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
1082 if (!old_valid_dev(rdev)) 1082 if (!old_valid_dev(rdev))
1083 return -EINVAL; 1083 return -EINVAL;
1084 lock_kernel(); 1084 lock_kernel();
1085 dir_f = (struct jffs_file *)dir->u.generic_ip; 1085 dir_f = dir->i_private;
1086 c = dir_f->c; 1086 c = dir_f->c;
1087 1087
1088 D3(printk (KERN_NOTICE "mknod(): down biglock\n")); 1088 D3(printk (KERN_NOTICE "mknod(): down biglock\n"));
@@ -1186,7 +1186,7 @@ jffs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
1186 kfree(_symname); 1186 kfree(_symname);
1187 }); 1187 });
1188 1188
1189 dir_f = (struct jffs_file *)dir->u.generic_ip; 1189 dir_f = dir->i_private;
1190 ASSERT(if (!dir_f) { 1190 ASSERT(if (!dir_f) {
1191 printk(KERN_ERR "jffs_symlink(): No reference to a " 1191 printk(KERN_ERR "jffs_symlink(): No reference to a "
1192 "jffs_file struct in inode.\n"); 1192 "jffs_file struct in inode.\n");
@@ -1289,7 +1289,7 @@ jffs_create(struct inode *dir, struct dentry *dentry, int mode,
1289 kfree(s); 1289 kfree(s);
1290 }); 1290 });
1291 1291
1292 dir_f = (struct jffs_file *)dir->u.generic_ip; 1292 dir_f = dir->i_private;
1293 ASSERT(if (!dir_f) { 1293 ASSERT(if (!dir_f) {
1294 printk(KERN_ERR "jffs_create(): No reference to a " 1294 printk(KERN_ERR "jffs_create(): No reference to a "
1295 "jffs_file struct in inode.\n"); 1295 "jffs_file struct in inode.\n");
@@ -1403,9 +1403,9 @@ jffs_file_write(struct file *filp, const char *buf, size_t count,
1403 goto out_isem; 1403 goto out_isem;
1404 } 1404 }
1405 1405
1406 if (!(f = (struct jffs_file *)inode->u.generic_ip)) { 1406 if (!(f = inode->i_private)) {
1407 D(printk("jffs_file_write(): inode->u.generic_ip = 0x%p\n", 1407 D(printk("jffs_file_write(): inode->i_private = 0x%p\n",
1408 inode->u.generic_ip)); 1408 inode->i_private));
1409 goto out_isem; 1409 goto out_isem;
1410 } 1410 }
1411 1411
@@ -1693,7 +1693,7 @@ jffs_read_inode(struct inode *inode)
1693 mutex_unlock(&c->fmc->biglock); 1693 mutex_unlock(&c->fmc->biglock);
1694 return; 1694 return;
1695 } 1695 }
1696 inode->u.generic_ip = (void *)f; 1696 inode->i_private = f;
1697 inode->i_mode = f->mode; 1697 inode->i_mode = f->mode;
1698 inode->i_nlink = f->nlink; 1698 inode->i_nlink = f->nlink;
1699 inode->i_uid = f->uid; 1699 inode->i_uid = f->uid;
@@ -1748,7 +1748,7 @@ jffs_delete_inode(struct inode *inode)
1748 lock_kernel(); 1748 lock_kernel();
1749 inode->i_size = 0; 1749 inode->i_size = 0;
1750 inode->i_blocks = 0; 1750 inode->i_blocks = 0;
1751 inode->u.generic_ip = NULL; 1751 inode->i_private = NULL;
1752 clear_inode(inode); 1752 clear_inode(inode);
1753 if (inode->i_nlink == 0) { 1753 if (inode->i_nlink == 0) {
1754 c = (struct jffs_control *) inode->i_sb->s_fs_info; 1754 c = (struct jffs_control *) inode->i_sb->s_fs_info;