linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] [PATCH 0/8] Inode slimming
@ 2006-06-19 15:20 Theodore Tso
  2006-06-19 15:20 ` [RFC] [PATCH 1/8] inode_diet: Replace inode.u.generic_ip with inode.i_private Theodore Tso
                   ` (8 more replies)
  0 siblings, 9 replies; 46+ messages in thread
From: Theodore Tso @ 2006-06-19 15:20 UTC (permalink / raw)
  To: linux-kernel

The following patches reduce the size of struct inode.  Unfortunately,
since these structures are used by a large amount of kernel code, some
of the patches are quite involved, and/or will require a lot of
auditing and code review, for "only" 4 or 8 bytes at a time (maybe
more on 64-bit platforms).  However, since there are many, many copies
of struct inode all over the kernel, even a small reduction in size
can have a large beneficial result, and as the old Chinese saying
goes, a journey of thousand miles begins with a single step....

What else remains to be done?  There are a large number of fields in
struct inode which are never populated unless the inode is open, and
those should get moved into another structure which is populated only
when needed.  There are a large number of inodes which are read into
memory only because stat(2) was called on them (thanks to things like
color ls, et. al).  

Linus has suggested moving the i_data structure out to a separate
structure, again because there are many inodes which do not have any
pages cached in the page cache.  The challenge with this a huge number
of codepaths assume that i_mapping is always non-NULL.  But, i_data is
*huge* so the benefits of not having it taking up memory would make
this a high-return activity.

Another possibility is moving i_size into the file-specific area of
the union, which would save 8 bytes.  However there are a largish
number block device drivers that seem to have hijacked i_size to store
the blocksize(!?!) of the device, and that should really be done in a
bdev-specific structure.  Untangling this will be somewhat
challenging, but should be doable.

--

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [RFC] [PATCH 1/8] inode_diet: Replace inode.u.generic_ip with inode.i_private
  2006-06-19 15:20 [RFC] [PATCH 0/8] Inode slimming Theodore Tso
@ 2006-06-19 15:20 ` Theodore Tso
  2006-06-19 17:17   ` Jan Engelhardt
                     ` (2 more replies)
  2006-06-19 15:20 ` [RFC] [PATCH 2/8] inode-diet: Move i_pipe into a union Theodore Tso
                   ` (7 subsequent siblings)
  8 siblings, 3 replies; 46+ messages in thread
From: Theodore Tso @ 2006-06-19 15:20 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: inode-slim-1 --]
[-- Type: text/plain, Size: 31493 bytes --]

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.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>

Index: linux-2.6.17/include/linux/fs.h
===================================================================
--- linux-2.6.17.orig/include/linux/fs.h	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/include/linux/fs.h	2006-06-18 18:58:55.000000000 -0400
@@ -534,9 +534,7 @@
 
 	atomic_t		i_writecount;
 	void			*i_security;
-	union {
-		void		*generic_ip;
-	} u;
+	void			*i_private; /* fs or device private pointer */
 #ifdef __NEED_I_SIZE_ORDERED
 	seqcount_t		i_size_seqcount;
 #endif
Index: linux-2.6.17/arch/powerpc/platforms/cell/spufs/inode.c
===================================================================
--- linux-2.6.17.orig/arch/powerpc/platforms/cell/spufs/inode.c	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/arch/powerpc/platforms/cell/spufs/inode.c	2006-06-18 18:58:55.000000000 -0400
@@ -120,7 +120,7 @@
 	ret = 0;
 	inode->i_op = &spufs_file_iops;
 	inode->i_fop = fops;
-	inode->u.generic_ip = SPUFS_I(inode)->i_ctx = get_spu_context(ctx);
+	inode->i_private = SPUFS_I(inode)->i_ctx = get_spu_context(ctx);
 	d_add(dentry, inode);
 out:
 	return ret;
Index: linux-2.6.17/arch/s390/kernel/debug.c
===================================================================
--- linux-2.6.17.orig/arch/s390/kernel/debug.c	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/arch/s390/kernel/debug.c	2006-06-18 18:58:55.000000000 -0400
@@ -604,7 +604,7 @@
 	debug_info_t *debug_info, *debug_info_snapshot;
 
 	down(&debug_lock);
-	debug_info = (struct debug_info*)file->f_dentry->d_inode->u.generic_ip;
+	debug_info = (struct debug_info*)file->f_dentry->d_inode->i_private;
 	/* find debug view */
 	for (i = 0; i < DEBUG_MAX_VIEWS; i++) {
 		if (!debug_info->views[i])
Index: linux-2.6.17/drivers/i2c/chips/tps65010.c
===================================================================
--- linux-2.6.17.orig/drivers/i2c/chips/tps65010.c	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/drivers/i2c/chips/tps65010.c	2006-06-18 18:58:55.000000000 -0400
@@ -307,7 +307,7 @@
 
 static int dbg_tps_open(struct inode *inode, struct file *file)
 {
-	return single_open(file, dbg_show, inode->u.generic_ip);
+	return single_open(file, dbg_show, inode->i_private);
 }
 
 static struct file_operations debug_fops = {
Index: linux-2.6.17/drivers/infiniband/ulp/ipoib/ipoib_fs.c
===================================================================
--- linux-2.6.17.orig/drivers/infiniband/ulp/ipoib/ipoib_fs.c	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/drivers/infiniband/ulp/ipoib/ipoib_fs.c	2006-06-18 18:58:55.000000000 -0400
@@ -141,7 +141,7 @@
 		return ret;
 
 	seq = file->private_data;
-	seq->private = inode->u.generic_ip;
+	seq->private = inode->i_private;
 
 	return 0;
 }
@@ -247,7 +247,7 @@
 		return ret;
 
 	seq = file->private_data;
-	seq->private = inode->u.generic_ip;
+	seq->private = inode->i_private;
 
 	return 0;
 }
Index: linux-2.6.17/drivers/misc/ibmasm/ibmasmfs.c
===================================================================
--- linux-2.6.17.orig/drivers/misc/ibmasm/ibmasmfs.c	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/drivers/misc/ibmasm/ibmasmfs.c	2006-06-18 18:58:55.000000000 -0400
@@ -174,7 +174,7 @@
 	}
 
 	inode->i_fop = fops;
-	inode->u.generic_ip = data;
+	inode->i_private = data;
 
 	d_add(dentry, inode);
 	return dentry;
@@ -243,7 +243,7 @@
 {
 	struct ibmasmfs_command_data *command_data;
 
-	if (!inode->u.generic_ip)
+	if (!inode->i_private)
 		return -ENODEV;
 
 	command_data = kmalloc(sizeof(struct ibmasmfs_command_data), GFP_KERNEL);
@@ -251,7 +251,7 @@
 		return -ENOMEM;
 
 	command_data->command = NULL;
-	command_data->sp = inode->u.generic_ip;
+	command_data->sp = inode->i_private;
 	file->private_data = command_data;
 	return 0;
 }
@@ -350,10 +350,10 @@
 	struct ibmasmfs_event_data *event_data;
 	struct service_processor *sp; 
 
-	if (!inode->u.generic_ip)
+	if (!inode->i_private)
 		return -ENODEV;
 
-	sp = inode->u.generic_ip;
+	sp = inode->i_private;
 
 	event_data = kmalloc(sizeof(struct ibmasmfs_event_data), GFP_KERNEL);
 	if (!event_data)
@@ -438,14 +438,14 @@
 {
 	struct ibmasmfs_heartbeat_data *rhbeat;
 
-	if (!inode->u.generic_ip)
+	if (!inode->i_private)
 		return -ENODEV;
 
 	rhbeat = kmalloc(sizeof(struct ibmasmfs_heartbeat_data), GFP_KERNEL);
 	if (!rhbeat)
 		return -ENOMEM;
 
-	rhbeat->sp = (struct service_processor *)inode->u.generic_ip;
+	rhbeat->sp = (struct service_processor *)inode->i_private;
 	rhbeat->active = 0;
 	ibmasm_init_reverse_heartbeat(rhbeat->sp, &rhbeat->heartbeat);
 	file->private_data = rhbeat;
@@ -507,7 +507,7 @@
 
 static int remote_settings_file_open(struct inode *inode, struct file *file)
 {
-	file->private_data = inode->u.generic_ip;
+	file->private_data = inode->i_private;
 	return 0;
 }
 
Index: linux-2.6.17/drivers/net/irda/vlsi_ir.h
===================================================================
--- linux-2.6.17.orig/drivers/net/irda/vlsi_ir.h	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/drivers/net/irda/vlsi_ir.h	2006-06-18 18:58:55.000000000 -0400
@@ -58,7 +58,7 @@
 
 /* PDE() introduced in 2.5.4 */
 #ifdef CONFIG_PROC_FS
-#define PDE(inode) ((inode)->u.generic_ip)
+#define PDE(inode) ((inode)->i_private)
 #endif
 
 /* irda crc16 calculation exported in 2.5.42 */
Index: linux-2.6.17/drivers/oprofile/oprofilefs.c
===================================================================
--- linux-2.6.17.orig/drivers/oprofile/oprofilefs.c	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/drivers/oprofile/oprofilefs.c	2006-06-18 18:58:55.000000000 -0400
@@ -110,8 +110,8 @@
 
 static int default_open(struct inode * inode, struct file * filp)
 {
-	if (inode->u.generic_ip)
-		filp->private_data = inode->u.generic_ip;
+	if (inode->i_private)
+		filp->private_data = inode->i_private;
 	return 0;
 }
 
@@ -158,7 +158,7 @@
 	if (!d)
 		return -EFAULT;
 
-	d->d_inode->u.generic_ip = val;
+	d->d_inode->i_private = val;
 	return 0;
 }
 
@@ -171,7 +171,7 @@
 	if (!d)
 		return -EFAULT;
 
-	d->d_inode->u.generic_ip = val;
+	d->d_inode->i_private = val;
 	return 0;
 }
 
@@ -197,7 +197,7 @@
 	if (!d)
 		return -EFAULT;
 
-	d->d_inode->u.generic_ip = val;
+	d->d_inode->i_private = val;
 	return 0;
 }
 
Index: linux-2.6.17/drivers/pci/hotplug/cpqphp_sysfs.c
===================================================================
--- linux-2.6.17.orig/drivers/pci/hotplug/cpqphp_sysfs.c	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/drivers/pci/hotplug/cpqphp_sysfs.c	2006-06-18 18:58:55.000000000 -0400
@@ -141,7 +141,7 @@
 
 static int open(struct inode *inode, struct file *file)
 {
-	struct controller *ctrl = inode->u.generic_ip;
+	struct controller *ctrl = inode->i_private;
 	struct ctrl_dbg *dbg;
 	int retval = -ENOMEM;
 
Index: linux-2.6.17/drivers/usb/core/devio.c
===================================================================
--- linux-2.6.17.orig/drivers/usb/core/devio.c	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/drivers/usb/core/devio.c	2006-06-18 18:58:55.000000000 -0400
@@ -553,7 +553,7 @@
 	if (imajor(inode) == USB_DEVICE_MAJOR)
 		dev = usbdev_lookup_minor(iminor(inode));
 	if (!dev)
-		dev = inode->u.generic_ip;
+		dev = inode->i_private;
 	if (!dev) {
 		kfree(ps);
 		goto out;
Index: linux-2.6.17/drivers/usb/core/inode.c
===================================================================
--- linux-2.6.17.orig/drivers/usb/core/inode.c	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/drivers/usb/core/inode.c	2006-06-18 18:58:55.000000000 -0400
@@ -403,8 +403,8 @@
 
 static int default_open (struct inode *inode, struct file *file)
 {
-	if (inode->u.generic_ip)
-		file->private_data = inode->u.generic_ip;
+	if (inode->i_private)
+		file->private_data = inode->i_private;
 
 	return 0;
 }
@@ -510,7 +510,7 @@
 	} else {
 		if (dentry->d_inode) {
 			if (data)
-				dentry->d_inode->u.generic_ip = data;
+				dentry->d_inode->i_private = data;
 			if (fops)
 				dentry->d_inode->i_fop = fops;
 			dentry->d_inode->i_uid = uid;
Index: linux-2.6.17/drivers/usb/gadget/inode.c
===================================================================
--- linux-2.6.17.orig/drivers/usb/gadget/inode.c	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/drivers/usb/gadget/inode.c	2006-06-18 18:58:55.000000000 -0400
@@ -845,7 +845,7 @@
 static int
 ep_open (struct inode *inode, struct file *fd)
 {
-	struct ep_data		*data = inode->u.generic_ip;
+	struct ep_data		*data = inode->i_private;
 	int			value = -EBUSY;
 
 	if (down_interruptible (&data->lock) != 0)
@@ -1908,7 +1908,7 @@
 static int
 dev_open (struct inode *inode, struct file *fd)
 {
-	struct dev_data		*dev = inode->u.generic_ip;
+	struct dev_data		*dev = inode->i_private;
 	int			value = -EBUSY;
 
 	if (dev->state == STATE_DEV_DISABLED) {
@@ -1969,7 +1969,7 @@
 		inode->i_blocks = 0;
 		inode->i_atime = inode->i_mtime = inode->i_ctime
 				= CURRENT_TIME;
-		inode->u.generic_ip = data;
+		inode->i_private = data;
 		inode->i_fop = fops;
 	}
 	return inode;
Index: linux-2.6.17/drivers/usb/host/isp116x-hcd.c
===================================================================
--- linux-2.6.17.orig/drivers/usb/host/isp116x-hcd.c	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/drivers/usb/host/isp116x-hcd.c	2006-06-18 18:58:55.000000000 -0400
@@ -1204,7 +1204,7 @@
 
 static int isp116x_open_seq(struct inode *inode, struct file *file)
 {
-	return single_open(file, isp116x_show_dbg, inode->u.generic_ip);
+	return single_open(file, isp116x_show_dbg, inode->i_private);
 }
 
 static struct file_operations isp116x_debug_fops = {
Index: linux-2.6.17/drivers/usb/host/uhci-debug.c
===================================================================
--- linux-2.6.17.orig/drivers/usb/host/uhci-debug.c	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/drivers/usb/host/uhci-debug.c	2006-06-18 18:58:55.000000000 -0400
@@ -406,7 +406,7 @@
 
 static int uhci_debug_open(struct inode *inode, struct file *file)
 {
-	struct uhci_hcd *uhci = inode->u.generic_ip;
+	struct uhci_hcd *uhci = inode->i_private;
 	struct uhci_debug *up;
 	int ret = -ENOMEM;
 	unsigned long flags;
Index: linux-2.6.17/drivers/usb/mon/mon_stat.c
===================================================================
--- linux-2.6.17.orig/drivers/usb/mon/mon_stat.c	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/drivers/usb/mon/mon_stat.c	2006-06-18 18:58:55.000000000 -0400
@@ -28,7 +28,7 @@
 	if ((sp = kmalloc(sizeof(struct snap), GFP_KERNEL)) == NULL)
 		return -ENOMEM;
 
-	mbus = inode->u.generic_ip;
+	mbus = inode->i_private;
 
 	sp->slen = snprintf(sp->str, STAT_BUF_SIZE,
 	    "nreaders %d text_lost %u\n",
Index: linux-2.6.17/drivers/usb/mon/mon_text.c
===================================================================
--- linux-2.6.17.orig/drivers/usb/mon/mon_text.c	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/drivers/usb/mon/mon_text.c	2006-06-18 18:58:55.000000000 -0400
@@ -210,7 +210,7 @@
 	int rc;
 
 	mutex_lock(&mon_lock);
-	mbus = inode->u.generic_ip;
+	mbus = inode->i_private;
 	ubus = mbus->u_bus;
 
 	rp = kzalloc(sizeof(struct mon_reader_text), GFP_KERNEL);
@@ -372,7 +372,7 @@
 	struct mon_event_text *ep;
 
 	mutex_lock(&mon_lock);
-	mbus = inode->u.generic_ip;
+	mbus = inode->i_private;
 
 	if (mbus->nreaders <= 0) {
 		printk(KERN_ERR TAG ": consistency error on close\n");
Index: linux-2.6.17/fs/autofs/inode.c
===================================================================
--- linux-2.6.17.orig/fs/autofs/inode.c	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/fs/autofs/inode.c	2006-06-18 18:58:55.000000000 -0400
@@ -241,7 +241,7 @@
 		
 		inode->i_op = &autofs_symlink_inode_operations;
 		sl = &sbi->symlink[n];
-		inode->u.generic_ip = sl;
+		inode->i_private = sl;
 		inode->i_mode = S_IFLNK | S_IRWXUGO;
 		inode->i_mtime.tv_sec = inode->i_ctime.tv_sec = sl->mtime;
 		inode->i_mtime.tv_nsec = inode->i_ctime.tv_nsec = 0;
Index: linux-2.6.17/fs/autofs/symlink.c
===================================================================
--- linux-2.6.17.orig/fs/autofs/symlink.c	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/fs/autofs/symlink.c	2006-06-18 18:58:55.000000000 -0400
@@ -15,7 +15,7 @@
 /* Nothing to release.. */
 static void *autofs_follow_link(struct dentry *dentry, struct nameidata *nd)
 {
-	char *s=((struct autofs_symlink *)dentry->d_inode->u.generic_ip)->data;
+	char *s=((struct autofs_symlink *)dentry->d_inode->i_private)->data;
 	nd_set_link(nd, s);
 	return NULL;
 }
Index: linux-2.6.17/fs/binfmt_misc.c
===================================================================
--- linux-2.6.17.orig/fs/binfmt_misc.c	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/fs/binfmt_misc.c	2006-06-18 18:58:55.000000000 -0400
@@ -517,7 +517,7 @@
 
 static void bm_clear_inode(struct inode *inode)
 {
-	kfree(inode->u.generic_ip);
+	kfree(inode->i_private);
 }
 
 static void kill_node(Node *e)
@@ -545,7 +545,7 @@
 static ssize_t
 bm_entry_read(struct file * file, char __user * buf, size_t nbytes, loff_t *ppos)
 {
-	Node *e = file->f_dentry->d_inode->u.generic_ip;
+	Node *e = file->f_dentry->d_inode->i_private;
 	loff_t pos = *ppos;
 	ssize_t res;
 	char *page;
@@ -579,7 +579,7 @@
 				size_t count, loff_t *ppos)
 {
 	struct dentry *root;
-	Node *e = file->f_dentry->d_inode->u.generic_ip;
+	Node *e = file->f_dentry->d_inode->i_private;
 	int res = parse_command(buffer, count);
 
 	switch (res) {
@@ -646,7 +646,7 @@
 	}
 
 	e->dentry = dget(dentry);
-	inode->u.generic_ip = e;
+	inode->i_private = e;
 	inode->i_fop = &bm_entry_operations;
 
 	d_instantiate(dentry, inode);
Index: linux-2.6.17/fs/debugfs/file.c
===================================================================
--- linux-2.6.17.orig/fs/debugfs/file.c	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/fs/debugfs/file.c	2006-06-18 18:58:55.000000000 -0400
@@ -33,8 +33,8 @@
 
 static int default_open(struct inode *inode, struct file *file)
 {
-	if (inode->u.generic_ip)
-		file->private_data = inode->u.generic_ip;
+	if (inode->i_private)
+		file->private_data = inode->i_private;
 
 	return 0;
 }
Index: linux-2.6.17/fs/debugfs/inode.c
===================================================================
--- linux-2.6.17.orig/fs/debugfs/inode.c	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/fs/debugfs/inode.c	2006-06-18 18:58:55.000000000 -0400
@@ -170,7 +170,7 @@
  *          directory dentry if set.  If this paramater is NULL, then the
  *          file will be created in the root of the debugfs filesystem.
  * @data: a pointer to something that the caller will want to get to later
- *        on.  The inode.u.generic_ip pointer will point to this value on
+ *        on.  The inode.i_private pointer will point to this value on
  *        the open() call.
  * @fops: a pointer to a struct file_operations that should be used for
  *        this file.
@@ -211,7 +211,7 @@
 
 	if (dentry->d_inode) {
 		if (data)
-			dentry->d_inode->u.generic_ip = data;
+			dentry->d_inode->i_private = data;
 		if (fops)
 			dentry->d_inode->i_fop = fops;
 	}
Index: linux-2.6.17/fs/devfs/base.c
===================================================================
--- linux-2.6.17.orig/fs/devfs/base.c	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/fs/devfs/base.c	2006-06-18 18:58:55.000000000 -0400
@@ -26,7 +26,7 @@
                Original version.
   v0.1
     19980111   Richard Gooch <rgooch@atnf.csiro.au>
-               Created per-fs inode table rather than using inode->u.generic_ip
+               Created per-fs inode table rather than using inode->i_private
   v0.2
     19980111   Richard Gooch <rgooch@atnf.csiro.au>
                Created .epoch inode which has a ctime of 0.
@@ -521,7 +521,7 @@
   v0.109
     20010807   Richard Gooch <rgooch@atnf.csiro.au>
 	       Fixed inode table races by removing it and using
-	       inode->u.generic_ip instead.
+	       inode->i_private instead.
 	       Moved <devfs_read_inode> into <get_vfs_inode>.
 	       Moved <devfs_write_inode> into <devfs_notify_change>.
   v0.110
@@ -1266,8 +1266,8 @@
 {
 	if (inode == NULL)
 		return NULL;
-	VERIFY_ENTRY((struct devfs_entry *)inode->u.generic_ip);
-	return inode->u.generic_ip;
+	VERIFY_ENTRY((struct devfs_entry *)inode->i_private);
+	return inode->i_private;
 }				/*  End Function get_devfs_entry_from_vfs_inode  */
 
 /**
@@ -1920,7 +1920,7 @@
 		return NULL;
 	}
 	/* FIXME where is devfs_put? */
-	inode->u.generic_ip = devfs_get(de);
+	inode->i_private = devfs_get(de);
 	inode->i_ino = de->inode.ino;
 	DPRINTK(DEBUG_I_GET, "(%d): VFS inode: %p  devfs_entry: %p\n",
 		(int)inode->i_ino, inode, de);
Index: linux-2.6.17/fs/devpts/inode.c
===================================================================
--- linux-2.6.17.orig/fs/devpts/inode.c	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/fs/devpts/inode.c	2006-06-18 18:58:55.000000000 -0400
@@ -177,7 +177,7 @@
 	inode->i_gid = config.setgid ? config.gid : current->fsgid;
 	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
 	init_special_inode(inode, S_IFCHR|config.mode, device);
-	inode->u.generic_ip = tty;
+	inode->i_private = tty;
 
 	dentry = get_node(number);
 	if (!IS_ERR(dentry) && !dentry->d_inode)
@@ -196,7 +196,7 @@
 	tty = NULL;
 	if (!IS_ERR(dentry)) {
 		if (dentry->d_inode)
-			tty = dentry->d_inode->u.generic_ip;
+			tty = dentry->d_inode->i_private;
 		dput(dentry);
 	}
 
Index: linux-2.6.17/fs/freevxfs/vxfs.h
===================================================================
--- linux-2.6.17.orig/fs/freevxfs/vxfs.h	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/fs/freevxfs/vxfs.h	2006-06-18 18:58:55.000000000 -0400
@@ -252,7 +252,7 @@
  * Get filesystem private data from VFS inode.
  */
 #define VXFS_INO(ip) \
-	((struct vxfs_inode_info *)(ip)->u.generic_ip)
+	((struct vxfs_inode_info *)(ip)->i_private)
 
 /*
  * Get filesystem private data from VFS superblock.
Index: linux-2.6.17/fs/freevxfs/vxfs_inode.c
===================================================================
--- linux-2.6.17.orig/fs/freevxfs/vxfs_inode.c	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/fs/freevxfs/vxfs_inode.c	2006-06-18 18:58:55.000000000 -0400
@@ -243,7 +243,7 @@
 	ip->i_blocks = vip->vii_blocks;
 	ip->i_generation = vip->vii_gen;
 
-	ip->u.generic_ip = (void *)vip;
+	ip->i_private = (void *)vip;
 	
 }
 
@@ -338,5 +338,5 @@
 void
 vxfs_clear_inode(struct inode *ip)
 {
-	kmem_cache_free(vxfs_inode_cachep, ip->u.generic_ip);
+	kmem_cache_free(vxfs_inode_cachep, ip->i_private);
 }
Index: linux-2.6.17/fs/jffs/inode-v23.c
===================================================================
--- linux-2.6.17.orig/fs/jffs/inode-v23.c	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/fs/jffs/inode-v23.c	2006-06-18 18:58:55.000000000 -0400
@@ -369,7 +369,7 @@
 
 	f = jffs_find_file(c, raw_inode->ino);
 
-	inode->u.generic_ip = (void *)f;
+	inode->i_private = (void *)f;
 	insert_inode_hash(inode);
 
 	return inode;
@@ -442,7 +442,7 @@
 	});
 
 	result = -ENOTDIR;
-	if (!(old_dir_f = (struct jffs_file *)old_dir->u.generic_ip)) {
+	if (!(old_dir_f = (struct jffs_file *)old_dir->i_private)) {
 		D(printk("jffs_rename(): Old dir invalid.\n"));
 		goto jffs_rename_end;
 	}
@@ -456,7 +456,7 @@
 
 	/* Find the new directory.  */
 	result = -ENOTDIR;
-	if (!(new_dir_f = (struct jffs_file *)new_dir->u.generic_ip)) {
+	if (!(new_dir_f = (struct jffs_file *)new_dir->i_private)) {
 		D(printk("jffs_rename(): New dir invalid.\n"));
 		goto jffs_rename_end;
 	}
@@ -593,7 +593,7 @@
 		}
 		else {
 			ddino = ((struct jffs_file *)
-				 inode->u.generic_ip)->pino;
+				 inode->i_private)->pino;
 		}
 		D3(printk("jffs_readdir(): \"..\" %u\n", ddino));
 		if (filldir(dirent, "..", 2, filp->f_pos, ddino, DT_DIR) < 0) {
@@ -604,7 +604,7 @@
 		}
 		filp->f_pos++;
 	}
-	f = ((struct jffs_file *)inode->u.generic_ip)->children;
+	f = ((struct jffs_file *)inode->i_private)->children;
 
 	j = 2;
 	while(f && (f->deleted || j++ < filp->f_pos )) {
@@ -668,7 +668,7 @@
 	}
 
 	r = -EACCES;
-	if (!(d = (struct jffs_file *)dir->u.generic_ip)) {
+	if (!(d = (struct jffs_file *)dir->i_private)) {
 		D(printk("jffs_lookup(): No such inode! (%lu)\n",
 			 dir->i_ino));
 		goto jffs_lookup_end;
@@ -739,7 +739,7 @@
 	unsigned long read_len;
 	int result;
 	struct inode *inode = (struct inode*)page->mapping->host;
-	struct jffs_file *f = (struct jffs_file *)inode->u.generic_ip;
+	struct jffs_file *f = (struct jffs_file *)inode->i_private;
 	struct jffs_control *c = (struct jffs_control *)inode->i_sb->s_fs_info;
 	int r;
 	loff_t offset;
@@ -828,7 +828,7 @@
 	});
 
 	lock_kernel();
-	dir_f = (struct jffs_file *)dir->u.generic_ip;
+	dir_f = (struct jffs_file *)dir->i_private;
 
 	ASSERT(if (!dir_f) {
 		printk(KERN_ERR "jffs_mkdir(): No reference to a "
@@ -972,7 +972,7 @@
 		kfree(_name);
 	});
 
-	dir_f = (struct jffs_file *) dir->u.generic_ip;
+	dir_f = (struct jffs_file *) dir->i_private;
 	c = dir_f->c;
 
 	result = -ENOENT;
@@ -1082,7 +1082,7 @@
 	if (!old_valid_dev(rdev))
 		return -EINVAL;
 	lock_kernel();
-	dir_f = (struct jffs_file *)dir->u.generic_ip;
+	dir_f = (struct jffs_file *)dir->i_private;
 	c = dir_f->c;
 
 	D3(printk (KERN_NOTICE "mknod(): down biglock\n"));
@@ -1186,7 +1186,7 @@
 		kfree(_symname);
 	});
 
-	dir_f = (struct jffs_file *)dir->u.generic_ip;
+	dir_f = (struct jffs_file *)dir->i_private;
 	ASSERT(if (!dir_f) {
 		printk(KERN_ERR "jffs_symlink(): No reference to a "
 		       "jffs_file struct in inode.\n");
@@ -1289,7 +1289,7 @@
 		kfree(s);
 	});
 
-	dir_f = (struct jffs_file *)dir->u.generic_ip;
+	dir_f = (struct jffs_file *)dir->i_private;
 	ASSERT(if (!dir_f) {
 		printk(KERN_ERR "jffs_create(): No reference to a "
 		       "jffs_file struct in inode.\n");
@@ -1403,9 +1403,9 @@
 		goto out_isem;
 	}
 
-	if (!(f = (struct jffs_file *)inode->u.generic_ip)) {
-		D(printk("jffs_file_write(): inode->u.generic_ip = 0x%p\n",
-				inode->u.generic_ip));
+	if (!(f = (struct jffs_file *)inode->i_private)) {
+		D(printk("jffs_file_write(): inode->i_private = 0x%p\n",
+				inode->i_private));
 		goto out_isem;
 	}
 
@@ -1693,7 +1693,7 @@
 		mutex_unlock(&c->fmc->biglock);
 		return;
 	}
-	inode->u.generic_ip = (void *)f;
+	inode->i_private = (void *)f;
 	inode->i_mode = f->mode;
 	inode->i_nlink = f->nlink;
 	inode->i_uid = f->uid;
@@ -1748,7 +1748,7 @@
 	lock_kernel();
 	inode->i_size = 0;
 	inode->i_blocks = 0;
-	inode->u.generic_ip = NULL;
+	inode->i_private = NULL;
 	clear_inode(inode);
 	if (inode->i_nlink == 0) {
 		c = (struct jffs_control *) inode->i_sb->s_fs_info;
Index: linux-2.6.17/fs/libfs.c
===================================================================
--- linux-2.6.17.orig/fs/libfs.c	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/fs/libfs.c	2006-06-18 18:58:55.000000000 -0400
@@ -549,7 +549,7 @@
 
 	attr->get = get;
 	attr->set = set;
-	attr->data = inode->u.generic_ip;
+	attr->data = inode->i_private;
 	attr->fmt = fmt;
 	mutex_init(&attr->mutex);
 
Index: linux-2.6.17/fs/ocfs2/dlmglue.c
===================================================================
--- linux-2.6.17.orig/fs/ocfs2/dlmglue.c	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/fs/ocfs2/dlmglue.c	2006-06-18 18:58:55.000000000 -0400
@@ -1995,7 +1995,7 @@
 		mlog_errno(ret);
 		goto out;
 	}
-	osb = (struct ocfs2_super *) inode->u.generic_ip;
+	osb = (struct ocfs2_super *) inode->i_private;
 	ocfs2_get_dlm_debug(osb->osb_dlm_debug);
 	priv->p_dlm_debug = osb->osb_dlm_debug;
 	INIT_LIST_HEAD(&priv->p_iter_res.l_debug_list);
Index: linux-2.6.17/fs/openpromfs/inode.c
===================================================================
--- linux-2.6.17.orig/fs/openpromfs/inode.c	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/fs/openpromfs/inode.c	2006-06-18 18:58:55.000000000 -0400
@@ -70,9 +70,9 @@
 	struct inode *inode = file->f_dentry->d_inode;
 	char buffer[10];
 	
-	if (count < 0 || !inode->u.generic_ip)
+	if (count < 0 || !inode->i_private)
 		return -EINVAL;
-	sprintf (buffer, "%8.8x\n", (u32)(long)(inode->u.generic_ip));
+	sprintf (buffer, "%8.8x\n", (u32)(long)(inode->i_private));
 	if (file->f_pos >= 9)
 		return 0;
 	if (count > 9 - file->f_pos)
@@ -95,9 +95,9 @@
 	char buffer[64];
 	
 	if (!filp->private_data) {
-		node = nodes[(u16)((long)inode->u.generic_ip)].node;
-		i = ((u32)(long)inode->u.generic_ip) >> 16;
-		if ((u16)((long)inode->u.generic_ip) == aliases) {
+		node = nodes[(u16)((long)inode->i_private)].node;
+		i = ((u32)(long)inode->i_private) >> 16;
+		if ((u16)((long)inode->i_private) == aliases) {
 			if (i >= aliases_nodes)
 				p = NULL;
 			else
@@ -111,7 +111,7 @@
 			return -EIO;
 		i = prom_getproplen (node, p);
 		if (i < 0) {
-			if ((u16)((long)inode->u.generic_ip) == aliases)
+			if ((u16)((long)inode->i_private) == aliases)
 				i = 0;
 			else
 				return -EIO;
@@ -539,8 +539,8 @@
 	if (!op)
 		return 0;
 	lock_kernel();
-	node = nodes[(u16)((long)inode->u.generic_ip)].node;
-	if ((u16)((long)inode->u.generic_ip) == aliases) {
+	node = nodes[(u16)((long)inode->i_private)].node;
+	if ((u16)((long)inode->i_private) == aliases) {
 		if ((op->flag & OPP_DIRTY) && (op->flag & OPP_STRING)) {
 			char *p = op->name;
 			int i = (op->value - op->name) - strlen (op->name) - 1;
@@ -743,7 +743,7 @@
 		inode->i_mode = S_IFREG | S_IRUGO;
 		inode->i_fop = &openpromfs_nodenum_ops;
 		inode->i_nlink = 1;
-		inode->u.generic_ip = (void *)(long)(n);
+		inode->i_private = (void *)(long)(n);
 		break;
 	case OPFSL_PROPERTY:
 		if ((dirnode == options) && (len == 17)
@@ -760,7 +760,7 @@
 		inode->i_nlink = 1;
 		if (inode->i_size < 0)
 			inode->i_size = 0;
-		inode->u.generic_ip = (void *)(long)(((u16)dirnode) | 
+		inode->i_private = (void *)(long)(((u16)dirnode) |
 			(((u16)(ino - NODEP2INO(NODE(dir->i_ino).first_prop) - 1)) << 16));
 		break;
 	}
@@ -886,7 +886,7 @@
 	inode->i_fop = &openpromfs_prop_ops;
 	inode->i_nlink = 1;
 	if (inode->i_size < 0) inode->i_size = 0;
-	inode->u.generic_ip = (void *)(long)(((u16)aliases) | 
+	inode->i_private = (void *)(long)(((u16)aliases) |
 			(((u16)(aliases_nodes - 1)) << 16));
 	unlock_kernel();
 	d_instantiate(dentry, inode);
Index: linux-2.6.17/security/inode.c
===================================================================
--- linux-2.6.17.orig/security/inode.c	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/security/inode.c	2006-06-18 18:58:55.000000000 -0400
@@ -45,8 +45,8 @@
 
 static int default_open(struct inode *inode, struct file *file)
 {
-	if (inode->u.generic_ip)
-		file->private_data = inode->u.generic_ip;
+	if (inode->i_private)
+		file->private_data = inode->i_private;
 
 	return 0;
 }
@@ -195,7 +195,7 @@
  *          directory dentry if set.  If this paramater is NULL, then the
  *          file will be created in the root of the securityfs filesystem.
  * @data: a pointer to something that the caller will want to get to later
- *        on.  The inode.u.generic_ip pointer will point to this value on
+ *        on.  The inode.i_private pointer will point to this value on
  *        the open() call.
  * @fops: a pointer to a struct file_operations that should be used for
  *        this file.
@@ -241,7 +241,7 @@
 		if (fops)
 			dentry->d_inode->i_fop = fops;
 		if (data)
-			dentry->d_inode->u.generic_ip = data;
+			dentry->d_inode->i_private = data;
 	}
 exit:
 	return dentry;
Index: linux-2.6.17/fs/inode.c
===================================================================
--- linux-2.6.17.orig/fs/inode.c	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/fs/inode.c	2006-06-18 18:58:55.000000000 -0400
@@ -164,7 +164,7 @@
 				bdi = sb->s_bdev->bd_inode->i_mapping->backing_dev_info;
 			mapping->backing_dev_info = bdi;
 		}
-		memset(&inode->u, 0, sizeof(inode->u));
+		inode->i_private = 0;
 		inode->i_mapping = mapping;
 	}
 	return inode;
Index: linux-2.6.17/block/blktrace.c
===================================================================
--- linux-2.6.17.orig/block/blktrace.c	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/block/blktrace.c	2006-06-18 18:58:55.000000000 -0400
@@ -215,7 +215,7 @@
 
 static int blk_dropped_open(struct inode *inode, struct file *filp)
 {
-	filp->private_data = inode->u.generic_ip;
+	filp->private_data = inode->i_private;
 
 	return 0;
 }
Index: linux-2.6.17/drivers/infiniband/hw/ipath/ipath_fs.c
===================================================================
--- linux-2.6.17.orig/drivers/infiniband/hw/ipath/ipath_fs.c	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/drivers/infiniband/hw/ipath/ipath_fs.c	2006-06-18 18:58:55.000000000 -0400
@@ -64,7 +64,7 @@
 	inode->i_blksize = PAGE_CACHE_SIZE;
 	inode->i_blocks = 0;
 	inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
-	inode->u.generic_ip = data;
+	inode->i_private = data;
 	if ((mode & S_IFMT) == S_IFDIR) {
 		inode->i_op = &simple_dir_inode_operations;
 		inode->i_nlink++;
@@ -119,7 +119,7 @@
 	u16 i;
 	struct ipath_devdata *dd;
 
-	dd = file->f_dentry->d_inode->u.generic_ip;
+	dd = file->f_dentry->d_inode->i_private;
 
 	for (i = 0; i < NUM_COUNTERS; i++)
 		counters[i] = ipath_snap_cntr(dd, i);
@@ -139,7 +139,7 @@
 	struct ipath_devdata *dd;
 	u64 guid;
 
-	dd = file->f_dentry->d_inode->u.generic_ip;
+	dd = file->f_dentry->d_inode->i_private;
 
 	guid = be64_to_cpu(dd->ipath_guid);
 
@@ -178,7 +178,7 @@
 	u32 tmp, tmp2;
 	struct ipath_devdata *dd;
 
-	dd = file->f_dentry->d_inode->u.generic_ip;
+	dd = file->f_dentry->d_inode->i_private;
 
 	/* so we only initialize non-zero fields. */
 	memset(portinfo, 0, sizeof portinfo);
@@ -325,7 +325,7 @@
 		goto bail;
 	}
 
-	dd = file->f_dentry->d_inode->u.generic_ip;
+	dd = file->f_dentry->d_inode->i_private;
 	if (ipath_eeprom_read(dd, pos, tmp, count)) {
 		ipath_dev_err(dd, "failed to read from flash\n");
 		ret = -ENXIO;
@@ -381,7 +381,7 @@
 		goto bail_tmp;
 	}
 
-	dd = file->f_dentry->d_inode->u.generic_ip;
+	dd = file->f_dentry->d_inode->i_private;
 	if (ipath_eeprom_write(dd, pos, tmp, count)) {
 		ret = -ENXIO;
 		ipath_dev_err(dd, "failed to write to flash\n");
Index: linux-2.6.17/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c
===================================================================
--- linux-2.6.17.orig/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c	2006-06-18 18:58:55.000000000 -0400
@@ -54,7 +54,7 @@
 
 static int open_file_generic(struct inode *inode, struct file *file)
 {
-	file->private_data = inode->u.generic_ip;
+	file->private_data = inode->i_private;
 	return 0;
 }
 
Index: linux-2.6.17/kernel/relay.c
===================================================================
--- linux-2.6.17.orig/kernel/relay.c	2006-06-18 18:58:51.000000000 -0400
+++ linux-2.6.17/kernel/relay.c	2006-06-18 18:58:55.000000000 -0400
@@ -669,7 +669,7 @@
  */
 static int relay_file_open(struct inode *inode, struct file *filp)
 {
-	struct rchan_buf *buf = inode->u.generic_ip;
+	struct rchan_buf *buf = inode->i_private;
 	kref_get(&buf->kref);
 	filp->private_data = buf;
 

--

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [RFC] [PATCH 2/8] inode-diet: Move i_pipe into a union
  2006-06-19 15:20 [RFC] [PATCH 0/8] Inode slimming Theodore Tso
  2006-06-19 15:20 ` [RFC] [PATCH 1/8] inode_diet: Replace inode.u.generic_ip with inode.i_private Theodore Tso
@ 2006-06-19 15:20 ` Theodore Tso
  2006-06-19 17:19   ` Jan Engelhardt
  2006-06-19 15:20 ` [RFC] [PATCH 3/8] inode-diet: Move i_bdev " Theodore Tso
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 46+ messages in thread
From: Theodore Tso @ 2006-06-19 15:20 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: inode-slim-2 --]
[-- Type: text/plain, Size: 712 bytes --]

Move the i_pipe pointer into a union that will be shared with i_bdev
and i_cdev.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>


Index: linux-2.6.17/include/linux/fs.h
===================================================================
--- linux-2.6.17.orig/include/linux/fs.h	2006-06-18 19:37:39.000000000 -0400
+++ linux-2.6.17/include/linux/fs.h	2006-06-18 19:39:52.000000000 -0400
@@ -508,9 +508,10 @@
 #ifdef CONFIG_QUOTA
 	struct dquot		*i_dquot[MAXQUOTAS];
 #endif
-	/* These three should probably be a union */
 	struct list_head	i_devices;
-	struct pipe_inode_info	*i_pipe;
+	union {
+		struct pipe_inode_info	*i_pipe;
+	};
 	struct block_device	*i_bdev;
 	struct cdev		*i_cdev;
 	int			i_cindex;

--

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [RFC] [PATCH 3/8] inode-diet: Move i_bdev into a union
  2006-06-19 15:20 [RFC] [PATCH 0/8] Inode slimming Theodore Tso
  2006-06-19 15:20 ` [RFC] [PATCH 1/8] inode_diet: Replace inode.u.generic_ip with inode.i_private Theodore Tso
  2006-06-19 15:20 ` [RFC] [PATCH 2/8] inode-diet: Move i_pipe into a union Theodore Tso
@ 2006-06-19 15:20 ` Theodore Tso
  2006-06-19 15:20 ` [RFC] [PATCH 4/8] inode-diet: Move i_cdev " Theodore Tso
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 46+ messages in thread
From: Theodore Tso @ 2006-06-19 15:20 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: inode-slim-3 --]
[-- Type: text/plain, Size: 1520 bytes --]

Move the i_bdev pointer in struct inode into a union.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>


Index: linux-2.6.17/include/linux/fs.h
===================================================================
--- linux-2.6.17.orig/include/linux/fs.h	2006-06-18 19:39:52.000000000 -0400
+++ linux-2.6.17/include/linux/fs.h	2006-06-18 19:46:10.000000000 -0400
@@ -511,8 +511,8 @@
 	struct list_head	i_devices;
 	union {
 		struct pipe_inode_info	*i_pipe;
+		struct block_device	*i_bdev;
 	};
-	struct block_device	*i_bdev;
 	struct cdev		*i_cdev;
 	int			i_cindex;
 
Index: linux-2.6.17/fs/block_dev.c
===================================================================
--- linux-2.6.17.orig/fs/block_dev.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/block_dev.c	2006-06-18 19:46:10.000000000 -0400
@@ -439,7 +439,7 @@
 void bd_forget(struct inode *inode)
 {
 	spin_lock(&bdev_lock);
-	if (inode->i_bdev)
+	if (S_ISBLK(inode->i_mode) && inode->i_bdev)
 		__bd_forget(inode);
 	spin_unlock(&bdev_lock);
 }
Index: linux-2.6.17/fs/inode.c
===================================================================
--- linux-2.6.17.orig/fs/inode.c	2006-06-18 19:42:16.000000000 -0400
+++ linux-2.6.17/fs/inode.c	2006-06-18 19:46:10.000000000 -0400
@@ -255,7 +255,7 @@
 	DQUOT_DROP(inode);
 	if (inode->i_sb && inode->i_sb->s_op->clear_inode)
 		inode->i_sb->s_op->clear_inode(inode);
-	if (inode->i_bdev)
+	if (S_ISBLK(inode->i_mode) && inode->i_bdev)
 		bd_forget(inode);
 	if (inode->i_cdev)
 		cd_forget(inode);

--

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [RFC] [PATCH 4/8] inode-diet: Move i_cdev into a union
  2006-06-19 15:20 [RFC] [PATCH 0/8] Inode slimming Theodore Tso
                   ` (2 preceding siblings ...)
  2006-06-19 15:20 ` [RFC] [PATCH 3/8] inode-diet: Move i_bdev " Theodore Tso
@ 2006-06-19 15:20 ` Theodore Tso
  2006-06-19 17:20   ` Jan Engelhardt
  2006-06-19 15:20 ` [RFC] [PATCH 5/8] inode-diet: Eliminate i_blksize and use a per-superblock default Theodore Tso
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 46+ messages in thread
From: Theodore Tso @ 2006-06-19 15:20 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: inode-slim-4 --]
[-- Type: text/plain, Size: 1606 bytes --]

Move the i_cdev pointer in struct inode into a union.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>


Index: linux-2.6.17/include/linux/fs.h
===================================================================
--- linux-2.6.17.orig/include/linux/fs.h	2006-06-18 19:46:10.000000000 -0400
+++ linux-2.6.17/include/linux/fs.h	2006-06-18 19:50:56.000000000 -0400
@@ -512,8 +512,8 @@
 	union {
 		struct pipe_inode_info	*i_pipe;
 		struct block_device	*i_bdev;
+		struct cdev		*i_cdev;
 	};
-	struct cdev		*i_cdev;
 	int			i_cindex;
 
 	__u32			i_generation;
Index: linux-2.6.17/fs/file_table.c
===================================================================
--- linux-2.6.17.orig/fs/file_table.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/file_table.c	2006-06-18 19:50:56.000000000 -0400
@@ -170,7 +170,7 @@
 	if (file->f_op && file->f_op->release)
 		file->f_op->release(inode, file);
 	security_file_free(file);
-	if (unlikely(inode->i_cdev != NULL))
+	if (unlikely(S_ISCHR(inode->i_mode) && (inode->i_cdev != NULL)))
 		cdev_put(inode->i_cdev);
 	fops_put(file->f_op);
 	if (file->f_mode & FMODE_WRITE)
Index: linux-2.6.17/fs/inode.c
===================================================================
--- linux-2.6.17.orig/fs/inode.c	2006-06-18 19:46:10.000000000 -0400
+++ linux-2.6.17/fs/inode.c	2006-06-18 19:50:56.000000000 -0400
@@ -257,7 +257,7 @@
 		inode->i_sb->s_op->clear_inode(inode);
 	if (S_ISBLK(inode->i_mode) && inode->i_bdev)
 		bd_forget(inode);
-	if (inode->i_cdev)
+	if (S_ISCHR(inode->i_mode) && inode->i_cdev)
 		cd_forget(inode);
 	inode->i_state = I_CLEAR;
 }

--

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [RFC] [PATCH 5/8] inode-diet: Eliminate i_blksize and use a per-superblock default
  2006-06-19 15:20 [RFC] [PATCH 0/8] Inode slimming Theodore Tso
                   ` (3 preceding siblings ...)
  2006-06-19 15:20 ` [RFC] [PATCH 4/8] inode-diet: Move i_cdev " Theodore Tso
@ 2006-06-19 15:20 ` Theodore Tso
  2006-06-19 15:49   ` Avi Kivity
                     ` (2 more replies)
  2006-06-19 15:20 ` [RFC] [PATCH 6/8] inode-diet: Move i_cindex from struct inode to struct file Theodore Tso
                   ` (3 subsequent siblings)
  8 siblings, 3 replies; 46+ messages in thread
From: Theodore Tso @ 2006-06-19 15:20 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: inode-slim-5 --]
[-- Type: text/plain, Size: 52412 bytes --]

This eliminates the i_blksize field from struct inode and uses default
value in super->s_blksize.  Filesystems that want to provide a
per-inode st_blksize can do so by providing their own getattr routine
instead of using the generic_fillattr() function.

Note that some filesystems were providing pretty much random (and
incorrect) values for i_blksize.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>

Index: linux-2.6.17/include/linux/fs.h
===================================================================
--- linux-2.6.17.orig/include/linux/fs.h	2006-06-18 19:50:56.000000000 -0400
+++ linux-2.6.17/include/linux/fs.h	2006-06-18 19:53:54.000000000 -0400
@@ -492,7 +492,6 @@
 	struct timespec		i_mtime;
 	struct timespec		i_ctime;
 	unsigned int		i_blkbits;
-	unsigned long		i_blksize;
 	unsigned long		i_version;
 	blkcnt_t		i_blocks;
 	unsigned short          i_bytes;
@@ -867,6 +866,8 @@
 	/* Granularity of c/m/atime in ns.
 	   Cannot be worse than a second */
 	u32		   s_time_gran;
+	unsigned long	   s_blksize; /* Optimal i/o size for stat(2) */
+
 };
 
 extern struct timespec current_fs_time(struct super_block *sb);
Index: linux-2.6.17/fs/stat.c
===================================================================
--- linux-2.6.17.orig/fs/stat.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/stat.c	2006-06-18 19:53:54.000000000 -0400
@@ -33,7 +33,8 @@
 	stat->ctime = inode->i_ctime;
 	stat->size = i_size_read(inode);
 	stat->blocks = inode->i_blocks;
-	stat->blksize = inode->i_blksize;
+	if (inode->i_sb->s_blksize)
+		stat->blksize = inode->i_sb->s_blksize;
 }
 
 EXPORT_SYMBOL(generic_fillattr);
Index: linux-2.6.17/fs/binfmt_misc.c
===================================================================
--- linux-2.6.17.orig/fs/binfmt_misc.c	2006-06-18 19:37:39.000000000 -0400
+++ linux-2.6.17/fs/binfmt_misc.c	2006-06-18 19:53:54.000000000 -0400
@@ -507,7 +507,6 @@
 		inode->i_mode = mode;
 		inode->i_uid = 0;
 		inode->i_gid = 0;
-		inode->i_blksize = PAGE_CACHE_SIZE;
 		inode->i_blocks = 0;
 		inode->i_atime = inode->i_mtime = inode->i_ctime =
 			current_fs_time(inode->i_sb);
Index: linux-2.6.17/fs/eventpoll.c
===================================================================
--- linux-2.6.17.orig/fs/eventpoll.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/eventpoll.c	2006-06-18 19:53:54.000000000 -0400
@@ -1587,7 +1587,6 @@
 	inode->i_uid = current->fsuid;
 	inode->i_gid = current->fsgid;
 	inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
-	inode->i_blksize = PAGE_SIZE;
 	return inode;
 
 eexit_1:
Index: linux-2.6.17/fs/libfs.c
===================================================================
--- linux-2.6.17.orig/fs/libfs.c	2006-06-18 19:37:39.000000000 -0400
+++ linux-2.6.17/fs/libfs.c	2006-06-18 19:53:54.000000000 -0400
@@ -385,7 +385,6 @@
 		return -ENOMEM;
 	inode->i_mode = S_IFDIR | 0755;
 	inode->i_uid = inode->i_gid = 0;
-	inode->i_blksize = PAGE_CACHE_SIZE;
 	inode->i_blocks = 0;
 	inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
 	inode->i_op = &simple_dir_inode_operations;
@@ -407,7 +406,6 @@
 			goto out;
 		inode->i_mode = S_IFREG | files->mode;
 		inode->i_uid = inode->i_gid = 0;
-		inode->i_blksize = PAGE_CACHE_SIZE;
 		inode->i_blocks = 0;
 		inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
 		inode->i_fop = files->ops;
Index: linux-2.6.17/fs/pipe.c
===================================================================
--- linux-2.6.17.orig/fs/pipe.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/pipe.c	2006-06-18 19:53:54.000000000 -0400
@@ -879,7 +879,6 @@
 	inode->i_uid = current->fsuid;
 	inode->i_gid = current->fsgid;
 	inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
-	inode->i_blksize = PAGE_SIZE;
 
 	return inode;
 
Index: linux-2.6.17/fs/super.c
===================================================================
--- linux-2.6.17.orig/fs/super.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/super.c	2006-06-18 19:53:54.000000000 -0400
@@ -86,6 +86,7 @@
 		s->s_qcop = sb_quotactl_ops;
 		s->s_op = &default_op;
 		s->s_time_gran = 1000000000;
+		s->s_blksize = PAGE_CACHE_SIZE;
 	}
 out:
 	return s;
Index: linux-2.6.17/arch/powerpc/platforms/cell/spufs/inode.c
===================================================================
--- linux-2.6.17.orig/arch/powerpc/platforms/cell/spufs/inode.c	2006-06-18 19:37:39.000000000 -0400
+++ linux-2.6.17/arch/powerpc/platforms/cell/spufs/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -82,7 +82,6 @@
 	inode->i_mode = mode;
 	inode->i_uid = current->fsuid;
 	inode->i_gid = current->fsgid;
-	inode->i_blksize = PAGE_CACHE_SIZE;
 	inode->i_blocks = 0;
 	inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
 out:
Index: linux-2.6.17/drivers/isdn/capi/capifs.c
===================================================================
--- linux-2.6.17.orig/drivers/isdn/capi/capifs.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/drivers/isdn/capi/capifs.c	2006-06-18 19:53:54.000000000 -0400
@@ -104,7 +104,6 @@
 	inode->i_ino = 1;
 	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
 	inode->i_blocks = 0;
-	inode->i_blksize = 1024;
 	inode->i_uid = inode->i_gid = 0;
 	inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR;
 	inode->i_op = &simple_dir_inode_operations;
@@ -149,7 +148,6 @@
 	if (!inode)
 		return;
 	inode->i_ino = number+2;
-	inode->i_blksize = 1024;
 	inode->i_uid = config.setuid ? config.uid : current->fsuid;
 	inode->i_gid = config.setgid ? config.gid : current->fsgid;
 	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
Index: linux-2.6.17/drivers/misc/ibmasm/ibmasmfs.c
===================================================================
--- linux-2.6.17.orig/drivers/misc/ibmasm/ibmasmfs.c	2006-06-18 19:37:39.000000000 -0400
+++ linux-2.6.17/drivers/misc/ibmasm/ibmasmfs.c	2006-06-18 19:53:54.000000000 -0400
@@ -146,7 +146,6 @@
 	if (ret) {
 		ret->i_mode = mode;
 		ret->i_uid = ret->i_gid = 0;
-		ret->i_blksize = PAGE_CACHE_SIZE;
 		ret->i_blocks = 0;
 		ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME;
 	}
Index: linux-2.6.17/drivers/oprofile/oprofilefs.c
===================================================================
--- linux-2.6.17.orig/drivers/oprofile/oprofilefs.c	2006-06-18 19:37:39.000000000 -0400
+++ linux-2.6.17/drivers/oprofile/oprofilefs.c	2006-06-18 19:53:54.000000000 -0400
@@ -31,7 +31,6 @@
 		inode->i_mode = mode;
 		inode->i_uid = 0;
 		inode->i_gid = 0;
-		inode->i_blksize = PAGE_CACHE_SIZE;
 		inode->i_blocks = 0;
 		inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
 	}
Index: linux-2.6.17/drivers/usb/core/inode.c
===================================================================
--- linux-2.6.17.orig/drivers/usb/core/inode.c	2006-06-18 19:37:39.000000000 -0400
+++ linux-2.6.17/drivers/usb/core/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -250,7 +250,6 @@
 		inode->i_mode = mode;
 		inode->i_uid = current->fsuid;
 		inode->i_gid = current->fsgid;
-		inode->i_blksize = PAGE_CACHE_SIZE;
 		inode->i_blocks = 0;
 		inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
 		switch (mode & S_IFMT) {
Index: linux-2.6.17/drivers/usb/gadget/inode.c
===================================================================
--- linux-2.6.17.orig/drivers/usb/gadget/inode.c	2006-06-18 19:37:39.000000000 -0400
+++ linux-2.6.17/drivers/usb/gadget/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -1965,7 +1965,6 @@
 		inode->i_mode = mode;
 		inode->i_uid = default_uid;
 		inode->i_gid = default_gid;
-		inode->i_blksize = PAGE_CACHE_SIZE;
 		inode->i_blocks = 0;
 		inode->i_atime = inode->i_mtime = inode->i_ctime
 				= CURRENT_TIME;
Index: linux-2.6.17/fs/9p/vfs_inode.c
===================================================================
--- linux-2.6.17.orig/fs/9p/vfs_inode.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/9p/vfs_inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -204,7 +204,6 @@
 		inode->i_mode = mode;
 		inode->i_uid = current->fsuid;
 		inode->i_gid = current->fsgid;
-		inode->i_blksize = sb->s_blocksize;
 		inode->i_blocks = 0;
 		inode->i_rdev = 0;
 		inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
@@ -953,9 +952,8 @@
 
 	inode->i_size = stat->length;
 
-	inode->i_blksize = sb->s_blocksize;
 	inode->i_blocks =
-	    (inode->i_size + inode->i_blksize - 1) >> sb->s_blocksize_bits;
+	    (inode->i_size + sb->s_blocksize - 1) >> sb->s_blocksize_bits;
 }
 
 /**
Index: linux-2.6.17/fs/adfs/inode.c
===================================================================
--- linux-2.6.17.orig/fs/adfs/inode.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/adfs/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -269,7 +269,6 @@
 	inode->i_ino	 = obj->file_id;
 	inode->i_size	 = obj->size;
 	inode->i_nlink	 = 2;
-	inode->i_blksize = PAGE_SIZE;
 	inode->i_blocks	 = (inode->i_size + sb->s_blocksize - 1) >>
 			    sb->s_blocksize_bits;
 
Index: linux-2.6.17/fs/afs/inode.c
===================================================================
--- linux-2.6.17.orig/fs/afs/inode.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/afs/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -72,7 +72,6 @@
 	inode->i_ctime.tv_sec	= vnode->status.mtime_server;
 	inode->i_ctime.tv_nsec	= 0;
 	inode->i_atime		= inode->i_mtime = inode->i_ctime;
-	inode->i_blksize	= PAGE_CACHE_SIZE;
 	inode->i_blocks		= 0;
 	inode->i_version	= vnode->fid.unique;
 	inode->i_mapping->a_ops	= &afs_fs_aops;
Index: linux-2.6.17/fs/autofs/inode.c
===================================================================
--- linux-2.6.17.orig/fs/autofs/inode.c	2006-06-18 19:37:39.000000000 -0400
+++ linux-2.6.17/fs/autofs/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -216,7 +216,6 @@
 	inode->i_nlink = 2;
 	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
 	inode->i_blocks = 0;
-	inode->i_blksize = 1024;
 
 	if ( ino == AUTOFS_ROOT_INO ) {
 		inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR;
Index: linux-2.6.17/fs/autofs4/inode.c
===================================================================
--- linux-2.6.17.orig/fs/autofs4/inode.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/autofs4/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -446,7 +446,6 @@
 		inode->i_uid = 0;
 		inode->i_gid = 0;
 	}
-	inode->i_blksize = PAGE_CACHE_SIZE;
 	inode->i_blocks = 0;
 	inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
 
Index: linux-2.6.17/fs/befs/linuxvfs.c
===================================================================
--- linux-2.6.17.orig/fs/befs/linuxvfs.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/befs/linuxvfs.c	2006-06-18 19:53:54.000000000 -0400
@@ -365,7 +365,6 @@
 	inode->i_mtime.tv_nsec = 0;   /* lower 16 bits are not a time */	
 	inode->i_ctime = inode->i_mtime;
 	inode->i_atime = inode->i_mtime;
-	inode->i_blksize = befs_sb->block_size;
 
 	befs_ino->i_inode_num = fsrun_to_cpu(sb, raw_inode->inode_num);
 	befs_ino->i_parent = fsrun_to_cpu(sb, raw_inode->parent);
Index: linux-2.6.17/fs/bfs/dir.c
===================================================================
--- linux-2.6.17.orig/fs/bfs/dir.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/bfs/dir.c	2006-06-18 19:53:54.000000000 -0400
@@ -102,7 +102,7 @@
 	inode->i_uid = current->fsuid;
 	inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->fsgid;
 	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
-	inode->i_blocks = inode->i_blksize = 0;
+	inode->i_blocks = 0;
 	inode->i_op = &bfs_file_inops;
 	inode->i_fop = &bfs_file_operations;
 	inode->i_mapping->a_ops = &bfs_aops;
Index: linux-2.6.17/fs/bfs/inode.c
===================================================================
--- linux-2.6.17.orig/fs/bfs/inode.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/bfs/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -76,7 +76,6 @@
 	inode->i_size = BFS_FILESIZE(di);
 	inode->i_blocks = BFS_FILEBLOCKS(di);
         if (inode->i_size || inode->i_blocks) dprintf("Registered inode with %lld size, %ld blocks\n", inode->i_size, inode->i_blocks);
-	inode->i_blksize = PAGE_SIZE;
 	inode->i_atime.tv_sec =  le32_to_cpu(di->i_atime);
 	inode->i_mtime.tv_sec =  le32_to_cpu(di->i_mtime);
 	inode->i_ctime.tv_sec =  le32_to_cpu(di->i_ctime);
Index: linux-2.6.17/fs/configfs/inode.c
===================================================================
--- linux-2.6.17.orig/fs/configfs/inode.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/configfs/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -136,7 +136,6 @@
 {
 	struct inode * inode = new_inode(configfs_sb);
 	if (inode) {
-		inode->i_blksize = PAGE_CACHE_SIZE;
 		inode->i_blocks = 0;
 		inode->i_mapping->a_ops = &configfs_aops;
 		inode->i_mapping->backing_dev_info = &configfs_backing_dev_info;
Index: linux-2.6.17/fs/cramfs/inode.c
===================================================================
--- linux-2.6.17.orig/fs/cramfs/inode.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/cramfs/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -73,7 +73,6 @@
 	inode->i_uid = cramfs_inode->uid;
 	inode->i_size = cramfs_inode->size;
 	inode->i_blocks = (cramfs_inode->size - 1) / 512 + 1;
-	inode->i_blksize = PAGE_CACHE_SIZE;
 	inode->i_gid = cramfs_inode->gid;
 	/* Struct copy intentional */
 	inode->i_mtime = inode->i_atime = inode->i_ctime = zerotime;
Index: linux-2.6.17/fs/debugfs/inode.c
===================================================================
--- linux-2.6.17.orig/fs/debugfs/inode.c	2006-06-18 19:37:39.000000000 -0400
+++ linux-2.6.17/fs/debugfs/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -41,7 +41,6 @@
 		inode->i_mode = mode;
 		inode->i_uid = 0;
 		inode->i_gid = 0;
-		inode->i_blksize = PAGE_CACHE_SIZE;
 		inode->i_blocks = 0;
 		inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
 		switch (mode & S_IFMT) {
Index: linux-2.6.17/fs/devpts/inode.c
===================================================================
--- linux-2.6.17.orig/fs/devpts/inode.c	2006-06-18 19:37:39.000000000 -0400
+++ linux-2.6.17/fs/devpts/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -113,7 +113,6 @@
 	inode->i_ino = 1;
 	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
 	inode->i_blocks = 0;
-	inode->i_blksize = 1024;
 	inode->i_uid = inode->i_gid = 0;
 	inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR;
 	inode->i_op = &simple_dir_inode_operations;
@@ -172,7 +171,6 @@
 		return -ENOMEM;
 
 	inode->i_ino = number+2;
-	inode->i_blksize = 1024;
 	inode->i_uid = config.setuid ? config.uid : current->fsuid;
 	inode->i_gid = config.setgid ? config.gid : current->fsgid;
 	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
Index: linux-2.6.17/fs/ext2/ialloc.c
===================================================================
--- linux-2.6.17.orig/fs/ext2/ialloc.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/ext2/ialloc.c	2006-06-18 19:53:54.000000000 -0400
@@ -575,7 +575,6 @@
 	inode->i_mode = mode;
 
 	inode->i_ino = ino;
-	inode->i_blksize = PAGE_SIZE;	/* This is the optimal IO size (for stat), not the fs block size */
 	inode->i_blocks = 0;
 	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
 	memset(ei->i_data, 0, sizeof(ei->i_data));
Index: linux-2.6.17/fs/ext2/inode.c
===================================================================
--- linux-2.6.17.orig/fs/ext2/inode.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/ext2/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -1094,7 +1094,6 @@
 		brelse (bh);
 		goto bad_inode;
 	}
-	inode->i_blksize = PAGE_SIZE;	/* This is the optimal IO size (for stat), not the fs block size */
 	inode->i_blocks = le32_to_cpu(raw_inode->i_blocks);
 	ei->i_flags = le32_to_cpu(raw_inode->i_flags);
 	ei->i_faddr = le32_to_cpu(raw_inode->i_faddr);
Index: linux-2.6.17/fs/ext3/ialloc.c
===================================================================
--- linux-2.6.17.orig/fs/ext3/ialloc.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/ext3/ialloc.c	2006-06-18 19:53:54.000000000 -0400
@@ -557,7 +557,6 @@
 
 	inode->i_ino = ino;
 	/* This is the optimal IO size (for stat), not the fs block size */
-	inode->i_blksize = PAGE_SIZE;
 	inode->i_blocks = 0;
 	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
 
Index: linux-2.6.17/fs/ext3/inode.c
===================================================================
--- linux-2.6.17.orig/fs/ext3/inode.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/ext3/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -2627,9 +2627,6 @@
 		 * recovery code: that's fine, we're about to complete
 		 * the process of deleting those. */
 	}
-	inode->i_blksize = PAGE_SIZE;	/* This is the optimal IO size
-					 * (for stat), not the fs block
-					 * size */  
 	inode->i_blocks = le32_to_cpu(raw_inode->i_blocks);
 	ei->i_flags = le32_to_cpu(raw_inode->i_flags);
 #ifdef EXT3_FRAGMENTS
Index: linux-2.6.17/fs/fat/inode.c
===================================================================
--- linux-2.6.17.orig/fs/fat/inode.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/fat/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -375,8 +375,6 @@
 			inode->i_flags |= S_IMMUTABLE;
 	}
 	MSDOS_I(inode)->i_attrs = de->attr & ATTR_UNUSED;
-	/* this is as close to the truth as we can get ... */
-	inode->i_blksize = sbi->cluster_size;
 	inode->i_blocks = ((inode->i_size + (sbi->cluster_size - 1))
 			   & ~((loff_t)sbi->cluster_size - 1)) >> 9;
 	inode->i_mtime.tv_sec =
@@ -1137,7 +1135,6 @@
 		MSDOS_I(inode)->i_start = 0;
 		inode->i_size = sbi->dir_entries * sizeof(struct msdos_dir_entry);
 	}
-	inode->i_blksize = sbi->cluster_size;
 	inode->i_blocks = ((inode->i_size + (sbi->cluster_size - 1))
 			   & ~((loff_t)sbi->cluster_size - 1)) >> 9;
 	MSDOS_I(inode)->i_logstart = 0;
Index: linux-2.6.17/fs/freevxfs/vxfs_inode.c
===================================================================
--- linux-2.6.17.orig/fs/freevxfs/vxfs_inode.c	2006-06-18 19:37:39.000000000 -0400
+++ linux-2.6.17/fs/freevxfs/vxfs_inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -239,7 +239,6 @@
 	ip->i_ctime.tv_nsec = 0;
 	ip->i_mtime.tv_nsec = 0;
 
-	ip->i_blksize = PAGE_SIZE;
 	ip->i_blocks = vip->vii_blocks;
 	ip->i_generation = vip->vii_gen;
 
Index: linux-2.6.17/fs/fuse/inode.c
===================================================================
--- linux-2.6.17.orig/fs/fuse/inode.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/fuse/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -115,7 +115,6 @@
 	inode->i_uid     = attr->uid;
 	inode->i_gid     = attr->gid;
 	i_size_write(inode, attr->size);
-	inode->i_blksize = PAGE_CACHE_SIZE;
 	inode->i_blocks  = attr->blocks;
 	inode->i_atime.tv_sec   = attr->atime;
 	inode->i_atime.tv_nsec  = attr->atimensec;
Index: linux-2.6.17/fs/hfs/inode.c
===================================================================
--- linux-2.6.17.orig/fs/hfs/inode.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/hfs/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -154,7 +154,6 @@
 	inode->i_gid = current->fsgid;
 	inode->i_nlink = 1;
 	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
-	inode->i_blksize = HFS_SB(sb)->alloc_blksz;
 	HFS_I(inode)->flags = 0;
 	HFS_I(inode)->rsrc_inode = NULL;
 	HFS_I(inode)->fs_blocks = 0;
@@ -284,7 +283,6 @@
 	inode->i_uid = hsb->s_uid;
 	inode->i_gid = hsb->s_gid;
 	inode->i_nlink = 1;
-	inode->i_blksize = HFS_SB(inode->i_sb)->alloc_blksz;
 
 	if (idata->key)
 		HFS_I(inode)->cat_key = *idata->key;
Index: linux-2.6.17/fs/hfsplus/inode.c
===================================================================
--- linux-2.6.17.orig/fs/hfsplus/inode.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/hfsplus/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -304,7 +304,6 @@
 	inode->i_gid = current->fsgid;
 	inode->i_nlink = 1;
 	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
-	inode->i_blksize = HFSPLUS_SB(sb).alloc_blksz;
 	INIT_LIST_HEAD(&HFSPLUS_I(inode).open_dir_list);
 	init_MUTEX(&HFSPLUS_I(inode).extents_lock);
 	atomic_set(&HFSPLUS_I(inode).opencnt, 0);
@@ -407,7 +406,6 @@
 	type = hfs_bnode_read_u16(fd->bnode, fd->entryoffset);
 
 	HFSPLUS_I(inode).dev = 0;
-	inode->i_blksize = HFSPLUS_SB(inode->i_sb).alloc_blksz;
 	if (type == HFSPLUS_FOLDER) {
 		struct hfsplus_cat_folder *folder = &entry.folder;
 
Index: linux-2.6.17/fs/hpfs/inode.c
===================================================================
--- linux-2.6.17.orig/fs/hpfs/inode.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/hpfs/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -17,7 +17,6 @@
 	i->i_gid = hpfs_sb(sb)->sb_gid;
 	i->i_mode = hpfs_sb(sb)->sb_mode;
 	hpfs_inode->i_conv = hpfs_sb(sb)->sb_conv;
-	i->i_blksize = 512;
 	i->i_size = -1;
 	i->i_blocks = -1;
 	
Index: linux-2.6.17/fs/hppfs/hppfs_kern.c
===================================================================
--- linux-2.6.17.orig/fs/hppfs/hppfs_kern.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/hppfs/hppfs_kern.c	2006-06-18 19:53:54.000000000 -0400
@@ -152,7 +152,6 @@
 	ino->i_mode = proc_ino->i_mode;
 	ino->i_nlink = proc_ino->i_nlink;
 	ino->i_size = proc_ino->i_size;
-	ino->i_blksize = proc_ino->i_blksize;
 	ino->i_blocks = proc_ino->i_blocks;
 }
 
Index: linux-2.6.17/fs/isofs/inode.c
===================================================================
--- linux-2.6.17.orig/fs/isofs/inode.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/isofs/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -1237,7 +1237,7 @@
 	}
 	inode->i_uid = sbi->s_uid;
 	inode->i_gid = sbi->s_gid;
-	inode->i_blocks = inode->i_blksize = 0;
+	inode->i_blocks = 0;
 
 	ei->i_format_parm[0] = 0;
 	ei->i_format_parm[1] = 0;
@@ -1293,7 +1293,6 @@
 			      isonum_711 (de->ext_attr_length));
 
 	/* Set the number of blocks for stat() - should be done before RR */
-	inode->i_blksize = PAGE_CACHE_SIZE; /* For stat() only */
 	inode->i_blocks  = (inode->i_size + 511) >> 9;
 
 	/*
Index: linux-2.6.17/fs/jffs/inode-v23.c
===================================================================
--- linux-2.6.17.orig/fs/jffs/inode-v23.c	2006-06-18 19:37:39.000000000 -0400
+++ linux-2.6.17/fs/jffs/inode-v23.c	2006-06-18 19:53:54.000000000 -0400
@@ -364,7 +364,6 @@
 	inode->i_ctime.tv_nsec = 0;
 	inode->i_mtime.tv_nsec = 0;
 	inode->i_atime.tv_nsec = 0;
-	inode->i_blksize = PAGE_SIZE;
 	inode->i_blocks = (inode->i_size + 511) >> 9;
 
 	f = jffs_find_file(c, raw_inode->ino);
@@ -1706,7 +1705,6 @@
 	inode->i_mtime.tv_nsec = 
 	inode->i_ctime.tv_nsec = 0;
 
-	inode->i_blksize = PAGE_SIZE;
 	inode->i_blocks = (inode->i_size + 511) >> 9;
 	if (S_ISREG(inode->i_mode)) {
 		inode->i_op = &jffs_file_inode_operations;
Index: linux-2.6.17/fs/jffs2/fs.c
===================================================================
--- linux-2.6.17.orig/fs/jffs2/fs.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/jffs2/fs.c	2006-06-18 19:53:54.000000000 -0400
@@ -254,7 +254,6 @@
 
 	inode->i_nlink = f->inocache->nlink;
 
-	inode->i_blksize = PAGE_SIZE;
 	inode->i_blocks = (inode->i_size + 511) >> 9;
 
 	switch (inode->i_mode & S_IFMT) {
@@ -430,7 +429,6 @@
 	inode->i_atime = inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC;
 	ri->atime = ri->mtime = ri->ctime = cpu_to_je32(I_SEC(inode->i_mtime));
 
-	inode->i_blksize = PAGE_SIZE;
 	inode->i_blocks = 0;
 	inode->i_size = 0;
 
Index: linux-2.6.17/fs/minix/bitmap.c
===================================================================
--- linux-2.6.17.orig/fs/minix/bitmap.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/minix/bitmap.c	2006-06-18 19:53:54.000000000 -0400
@@ -254,7 +254,7 @@
 	inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current->fsgid;
 	inode->i_ino = j;
 	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
-	inode->i_blocks = inode->i_blksize = 0;
+	inode->i_blocks = 0;
 	memset(&minix_i(inode)->u, 0, sizeof(minix_i(inode)->u));
 	insert_inode_hash(inode);
 	mark_inode_dirty(inode);
Index: linux-2.6.17/fs/minix/inode.c
===================================================================
--- linux-2.6.17.orig/fs/minix/inode.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/minix/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -392,7 +392,7 @@
 	inode->i_mtime.tv_nsec = 0;
 	inode->i_atime.tv_nsec = 0;
 	inode->i_ctime.tv_nsec = 0;
-	inode->i_blocks = inode->i_blksize = 0;
+	inode->i_blocks = 0;
 	for (i = 0; i < 9; i++)
 		minix_inode->u.i1_data[i] = raw_inode->i_zone[i];
 	minix_set_inode(inode, old_decode_dev(raw_inode->i_zone[0]));
@@ -425,7 +425,7 @@
 	inode->i_mtime.tv_nsec = 0;
 	inode->i_atime.tv_nsec = 0;
 	inode->i_ctime.tv_nsec = 0;
-	inode->i_blocks = inode->i_blksize = 0;
+	inode->i_blocks = 0;
 	for (i = 0; i < 10; i++)
 		minix_inode->u.i2_data[i] = raw_inode->i_zone[i];
 	minix_set_inode(inode, old_decode_dev(raw_inode->i_zone[0]));
Index: linux-2.6.17/fs/ntfs/inode.c
===================================================================
--- linux-2.6.17.orig/fs/ntfs/inode.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/ntfs/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -540,8 +540,6 @@
 
 	/* Setup the generic vfs inode parts now. */
 
-	/* This is the optimal IO size (for stat), not the fs block size. */
-	vi->i_blksize = PAGE_CACHE_SIZE;
 	/*
 	 * This is for checking whether an inode has changed w.r.t. a file so
 	 * that the file can be updated if necessary (compare with f_version).
@@ -1218,7 +1216,6 @@
 	base_ni = NTFS_I(base_vi);
 
 	/* Just mirror the values from the base inode. */
-	vi->i_blksize	= base_vi->i_blksize;
 	vi->i_version	= base_vi->i_version;
 	vi->i_uid	= base_vi->i_uid;
 	vi->i_gid	= base_vi->i_gid;
@@ -1488,7 +1485,6 @@
 	ni	= NTFS_I(vi);
 	base_ni = NTFS_I(base_vi);
 	/* Just mirror the values from the base inode. */
-	vi->i_blksize	= base_vi->i_blksize;
 	vi->i_version	= base_vi->i_version;
 	vi->i_uid	= base_vi->i_uid;
 	vi->i_gid	= base_vi->i_gid;
Index: linux-2.6.17/fs/ntfs/mft.c
===================================================================
--- linux-2.6.17.orig/fs/ntfs/mft.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/ntfs/mft.c	2006-06-18 19:53:54.000000000 -0400
@@ -2638,11 +2638,6 @@
 		}
 		vi->i_ino = bit;
 		/*
-		 * This is the optimal IO size (for stat), not the fs block
-		 * size.
-		 */
-		vi->i_blksize = PAGE_CACHE_SIZE;
-		/*
 		 * This is for checking whether an inode has changed w.r.t. a
 		 * file so that the file can be updated if necessary (compare
 		 * with f_version).
Index: linux-2.6.17/fs/ocfs2/dlm/dlmfs.c
===================================================================
--- linux-2.6.17.orig/fs/ocfs2/dlm/dlmfs.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/ocfs2/dlm/dlmfs.c	2006-06-18 19:53:54.000000000 -0400
@@ -335,7 +335,6 @@
 		inode->i_mode = mode;
 		inode->i_uid = current->fsuid;
 		inode->i_gid = current->fsgid;
-		inode->i_blksize = PAGE_CACHE_SIZE;
 		inode->i_blocks = 0;
 		inode->i_mapping->backing_dev_info = &dlmfs_backing_dev_info;
 		inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
@@ -362,7 +361,6 @@
 	inode->i_mode = mode;
 	inode->i_uid = current->fsuid;
 	inode->i_gid = current->fsgid;
-	inode->i_blksize = PAGE_CACHE_SIZE;
 	inode->i_blocks = 0;
 	inode->i_mapping->backing_dev_info = &dlmfs_backing_dev_info;
 	inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
Index: linux-2.6.17/fs/ocfs2/inode.c
===================================================================
--- linux-2.6.17.orig/fs/ocfs2/inode.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/ocfs2/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -251,7 +251,6 @@
 	inode->i_mode = le16_to_cpu(fe->i_mode);
 	inode->i_uid = le32_to_cpu(fe->i_uid);
 	inode->i_gid = le32_to_cpu(fe->i_gid);
-	inode->i_blksize = (u32)osb->s_clustersize;
 
 	/* Fast symlinks will have i_size but no allocated clusters. */
 	if (S_ISLNK(inode->i_mode) && !fe->i_clusters)
@@ -1174,7 +1173,6 @@
 	inode->i_uid = le32_to_cpu(fe->i_uid);
 	inode->i_gid = le32_to_cpu(fe->i_gid);
 	inode->i_mode = le16_to_cpu(fe->i_mode);
-	inode->i_blksize = (u32) osb->s_clustersize;
 	if (S_ISLNK(inode->i_mode) && le32_to_cpu(fe->i_clusters) == 0)
 		inode->i_blocks = 0;
 	else
Index: linux-2.6.17/fs/ocfs2/super.c
===================================================================
--- linux-2.6.17.orig/fs/ocfs2/super.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/ocfs2/super.c	2006-06-18 19:53:54.000000000 -0400
@@ -1390,7 +1390,7 @@
 	/* get some pseudo constants for clustersize bits */
 	osb->s_clustersize_bits =
 		le32_to_cpu(di->id2.i_super.s_clustersize_bits);
-	osb->s_clustersize = 1 << osb->s_clustersize_bits;
+	osb->s_blksize = osb->s_clustersize = 1 << osb->s_clustersize_bits;
 	mlog(0, "clusterbits=%d\n", osb->s_clustersize_bits);
 
 	if (osb->s_clustersize < OCFS2_MIN_CLUSTERSIZE ||
Index: linux-2.6.17/fs/qnx4/inode.c
===================================================================
--- linux-2.6.17.orig/fs/qnx4/inode.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/qnx4/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -496,7 +496,6 @@
 	inode->i_ctime.tv_sec   = le32_to_cpu(raw_inode->di_ctime);
 	inode->i_ctime.tv_nsec = 0;
 	inode->i_blocks  = le32_to_cpu(raw_inode->di_first_xtnt.xtnt_size);
-	inode->i_blksize = QNX4_DIR_ENTRY_SIZE;
 
 	memcpy(qnx4_inode, raw_inode, QNX4_DIR_ENTRY_SIZE);
 	if (S_ISREG(inode->i_mode)) {
Index: linux-2.6.17/fs/ramfs/inode.c
===================================================================
--- linux-2.6.17.orig/fs/ramfs/inode.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/ramfs/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -58,7 +58,6 @@
 		inode->i_mode = mode;
 		inode->i_uid = current->fsuid;
 		inode->i_gid = current->fsgid;
-		inode->i_blksize = PAGE_CACHE_SIZE;
 		inode->i_blocks = 0;
 		inode->i_mapping->a_ops = &ramfs_aops;
 		inode->i_mapping->backing_dev_info = &ramfs_backing_dev_info;
Index: linux-2.6.17/fs/reiserfs/inode.c
===================================================================
--- linux-2.6.17.orig/fs/reiserfs/inode.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/reiserfs/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -18,8 +18,6 @@
 #include <linux/writeback.h>
 #include <linux/quotaops.h>
 
-extern int reiserfs_default_io_size;	/* default io size devuned in super.c */
-
 static int reiserfs_commit_write(struct file *f, struct page *page,
 				 unsigned from, unsigned to);
 static int reiserfs_prepare_write(struct file *f, struct page *page,
@@ -1131,7 +1129,6 @@
 	ih = PATH_PITEM_HEAD(path);
 
 	copy_key(INODE_PKEY(inode), &(ih->ih_key));
-	inode->i_blksize = reiserfs_default_io_size;
 
 	INIT_LIST_HEAD(&(REISERFS_I(inode)->i_prealloc_list));
 	REISERFS_I(inode)->i_flags = 0;
@@ -1886,7 +1883,6 @@
 	}
 	// these do not go to on-disk stat data
 	inode->i_ino = le32_to_cpu(ih.ih_key.k_objectid);
-	inode->i_blksize = reiserfs_default_io_size;
 
 	// store in in-core inode the key of stat data and version all
 	// object items will have (directory items will have old offset
Index: linux-2.6.17/fs/reiserfs/super.c
===================================================================
--- linux-2.6.17.orig/fs/reiserfs/super.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/reiserfs/super.c	2006-06-18 19:53:54.000000000 -0400
@@ -726,12 +726,6 @@
 	{NULL, 0, 0},
 };
 
-int reiserfs_default_io_size = 128 * 1024;	/* Default recommended I/O size is 128k.
-						   There might be broken applications that are
-						   confused by this. Use nolargeio mount option
-						   to get usual i/o size = PAGE_SIZE.
-						 */
-
 /* proceed only one option from a list *cur - string containing of mount options
    opts - array of options which are accepted
    opt_arg - if option is found and requires an argument and if it is specifed
@@ -959,6 +953,12 @@
 			*commit_max_age = (unsigned int)val;
 		}
 
+		/*
+		 * Default recommended I/O size is 128k.
+		 * There might be broken applications that are
+		 * confused by this. Use nolargeio mount option
+		 * to get usual i/o size = PAGE_SIZE.
+		 */
 		if (c == 'w') {
 			char *p = NULL;
 			int val = simple_strtoul(arg, &p, 0);
@@ -970,9 +970,9 @@
 				return 0;
 			}
 			if (val)
-				reiserfs_default_io_size = PAGE_SIZE;
+				s->s_blksize = PAGE_SIZE;
 			else
-				reiserfs_default_io_size = 128 * 1024;
+				s->s_blksize = 128 * 1024;
 		}
 
 		if (c == 'j') {
Index: linux-2.6.17/fs/sysfs/inode.c
===================================================================
--- linux-2.6.17.orig/fs/sysfs/inode.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/sysfs/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -113,7 +113,6 @@
 {
 	struct inode * inode = new_inode(sysfs_sb);
 	if (inode) {
-		inode->i_blksize = PAGE_CACHE_SIZE;
 		inode->i_blocks = 0;
 		inode->i_mapping->a_ops = &sysfs_aops;
 		inode->i_mapping->backing_dev_info = &sysfs_backing_dev_info;
Index: linux-2.6.17/fs/sysv/ialloc.c
===================================================================
--- linux-2.6.17.orig/fs/sysv/ialloc.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/sysv/ialloc.c	2006-06-18 19:53:54.000000000 -0400
@@ -170,7 +170,7 @@
 	inode->i_uid = current->fsuid;
 	inode->i_ino = fs16_to_cpu(sbi, ino);
 	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
-	inode->i_blocks = inode->i_blksize = 0;
+	inode->i_blocks = 0;
 	memset(SYSV_I(inode)->i_data, 0, sizeof(SYSV_I(inode)->i_data));
 	SYSV_I(inode)->i_dir_start_lookup = 0;
 	insert_inode_hash(inode);
Index: linux-2.6.17/fs/sysv/inode.c
===================================================================
--- linux-2.6.17.orig/fs/sysv/inode.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/sysv/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -200,7 +200,7 @@
 	inode->i_ctime.tv_nsec = 0;
 	inode->i_atime.tv_nsec = 0;
 	inode->i_mtime.tv_nsec = 0;
-	inode->i_blocks = inode->i_blksize = 0;
+	inode->i_blocks = 0;
 
 	si = SYSV_I(inode);
 	for (block = 0; block < 10+1+1+1; block++)
Index: linux-2.6.17/fs/udf/ialloc.c
===================================================================
--- linux-2.6.17.orig/fs/udf/ialloc.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/udf/ialloc.c	2006-06-18 19:53:54.000000000 -0400
@@ -120,7 +120,6 @@
 	UDF_I_LOCATION(inode).logicalBlockNum = block;
 	UDF_I_LOCATION(inode).partitionReferenceNum = UDF_I_LOCATION(dir).partitionReferenceNum;
 	inode->i_ino = udf_get_lb_pblock(sb, UDF_I_LOCATION(inode), 0);
-	inode->i_blksize = PAGE_SIZE;
 	inode->i_blocks = 0;
 	UDF_I_LENEATTR(inode) = 0;
 	UDF_I_LENALLOC(inode) = 0;
Index: linux-2.6.17/fs/udf/inode.c
===================================================================
--- linux-2.6.17.orig/fs/udf/inode.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/udf/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -916,8 +916,6 @@
 	 *      i_nlink = 1
 	 *      i_op = NULL;
 	 */
-	inode->i_blksize = PAGE_SIZE;
-
 	bh = udf_read_ptagged(inode->i_sb, UDF_I_LOCATION(inode), 0, &ident);
 
 	if (!bh)
Index: linux-2.6.17/fs/ufs/ialloc.c
===================================================================
--- linux-2.6.17.orig/fs/ufs/ialloc.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/ufs/ialloc.c	2006-06-18 19:53:54.000000000 -0400
@@ -263,7 +263,6 @@
 		inode->i_gid = current->fsgid;
 
 	inode->i_ino = cg * uspi->s_ipg + bit;
-	inode->i_blksize = PAGE_SIZE;	/* This is the optimal IO size (for stat), not the fs block size */
 	inode->i_blocks = 0;
 	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
 	ufsi->i_flags = UFS_I(dir)->i_flags;
Index: linux-2.6.17/fs/ufs/inode.c
===================================================================
--- linux-2.6.17.orig/fs/ufs/inode.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/ufs/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -596,7 +596,6 @@
 	inode->i_atime.tv_nsec = 0;
 	inode->i_ctime.tv_nsec = 0;
 	inode->i_blocks = fs32_to_cpu(sb, ufs_inode->ui_blocks);
-	inode->i_blksize = PAGE_SIZE;   /* This is the optimal IO size (for stat) */
 	inode->i_version++;
 	ufsi->i_flags = fs32_to_cpu(sb, ufs_inode->ui_flags);
 	ufsi->i_gen = fs32_to_cpu(sb, ufs_inode->ui_gen);
@@ -668,7 +667,6 @@
 	inode->i_atime.tv_nsec = 0;
 	inode->i_ctime.tv_nsec = 0;
 	inode->i_blocks = fs64_to_cpu(sb, ufs2_inode->ui_blocks);
-	inode->i_blksize = PAGE_SIZE; /*This is the optimal IO size(for stat)*/
 
 	inode->i_version++;
 	ufsi->i_flags = fs32_to_cpu(sb, ufs2_inode->ui_flags);
Index: linux-2.6.17/include/linux/nfsd/nfsfh.h
===================================================================
--- linux-2.6.17.orig/include/linux/nfsd/nfsfh.h	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/include/linux/nfsd/nfsfh.h	2006-06-18 19:53:54.000000000 -0400
@@ -270,8 +270,8 @@
 	fhp->fh_post_uid	= inode->i_uid;
 	fhp->fh_post_gid	= inode->i_gid;
 	fhp->fh_post_size       = inode->i_size;
-	if (inode->i_blksize) {
-		fhp->fh_post_blksize    = inode->i_blksize;
+	if (inode->i_sb->s_blksize) {
+		fhp->fh_post_blksize    = inode->i_sb->s_blksize;
 		fhp->fh_post_blocks     = inode->i_blocks;
 	} else {
 		fhp->fh_post_blksize    = BLOCK_SIZE;
Index: linux-2.6.17/ipc/mqueue.c
===================================================================
--- linux-2.6.17.orig/ipc/mqueue.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/ipc/mqueue.c	2006-06-18 19:53:54.000000000 -0400
@@ -112,7 +112,6 @@
 		inode->i_mode = mode;
 		inode->i_uid = current->fsuid;
 		inode->i_gid = current->fsgid;
-		inode->i_blksize = PAGE_CACHE_SIZE;
 		inode->i_blocks = 0;
 		inode->i_mtime = inode->i_ctime = inode->i_atime =
 				CURRENT_TIME;
Index: linux-2.6.17/kernel/cpuset.c
===================================================================
--- linux-2.6.17.orig/kernel/cpuset.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/kernel/cpuset.c	2006-06-18 19:53:54.000000000 -0400
@@ -289,7 +289,6 @@
 		inode->i_mode = mode;
 		inode->i_uid = current->fsuid;
 		inode->i_gid = current->fsgid;
-		inode->i_blksize = PAGE_CACHE_SIZE;
 		inode->i_blocks = 0;
 		inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
 		inode->i_mapping->backing_dev_info = &cpuset_backing_dev_info;
Index: linux-2.6.17/mm/shmem.c
===================================================================
--- linux-2.6.17.orig/mm/shmem.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/mm/shmem.c	2006-06-18 19:53:54.000000000 -0400
@@ -1360,7 +1360,6 @@
 		inode->i_mode = mode;
 		inode->i_uid = current->fsuid;
 		inode->i_gid = current->fsgid;
-		inode->i_blksize = PAGE_CACHE_SIZE;
 		inode->i_blocks = 0;
 		inode->i_mapping->a_ops = &shmem_aops;
 		inode->i_mapping->backing_dev_info = &shmem_backing_dev_info;
Index: linux-2.6.17/net/sunrpc/rpc_pipe.c
===================================================================
--- linux-2.6.17.orig/net/sunrpc/rpc_pipe.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/net/sunrpc/rpc_pipe.c	2006-06-18 19:53:54.000000000 -0400
@@ -491,7 +491,6 @@
 		return NULL;
 	inode->i_mode = mode;
 	inode->i_uid = inode->i_gid = 0;
-	inode->i_blksize = PAGE_CACHE_SIZE;
 	inode->i_blocks = 0;
 	inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
 	switch(mode & S_IFMT) {
Index: linux-2.6.17/security/inode.c
===================================================================
--- linux-2.6.17.orig/security/inode.c	2006-06-18 19:37:39.000000000 -0400
+++ linux-2.6.17/security/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -65,7 +65,6 @@
 		inode->i_mode = mode;
 		inode->i_uid = 0;
 		inode->i_gid = 0;
-		inode->i_blksize = PAGE_CACHE_SIZE;
 		inode->i_blocks = 0;
 		inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
 		switch (mode & S_IFMT) {
Index: linux-2.6.17/security/selinux/selinuxfs.c
===================================================================
--- linux-2.6.17.orig/security/selinux/selinuxfs.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/security/selinux/selinuxfs.c	2006-06-18 19:53:54.000000000 -0400
@@ -707,7 +707,6 @@
 	if (ret) {
 		ret->i_mode = mode;
 		ret->i_uid = ret->i_gid = 0;
-		ret->i_blksize = PAGE_CACHE_SIZE;
 		ret->i_blocks = 0;
 		ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME;
 	}
Index: linux-2.6.17/fs/cifs/cifsfs.c
===================================================================
--- linux-2.6.17.orig/fs/cifs/cifsfs.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/cifs/cifsfs.c	2006-06-18 19:53:54.000000000 -0400
@@ -112,7 +112,7 @@
 #ifdef CONFIG_CIFS_QUOTA
 	sb->s_qcop = &cifs_quotactl_ops;
 #endif
-	sb->s_blocksize = CIFS_MAX_MSGSIZE;
+	sb->s_blksize = sb->s_blocksize = CIFS_MAX_MSGSIZE;
 	sb->s_blocksize_bits = 14;	/* default 2**14 = CIFS_MAX_MSGSIZE */
 	inode = iget(sb, ROOT_I);
 
@@ -254,7 +254,6 @@
 	file data or metadata */
 	cifs_inode->clientCanCacheRead = FALSE;
 	cifs_inode->clientCanCacheAll = FALSE;
-	cifs_inode->vfs_inode.i_blksize = CIFS_MAX_MSGSIZE;
 	cifs_inode->vfs_inode.i_blkbits = 14;  /* 2**14 = CIFS_MAX_MSGSIZE */
 	cifs_inode->vfs_inode.i_flags = S_NOATIME | S_NOCMTIME;
 	INIT_LIST_HEAD(&cifs_inode->openFileList);
Index: linux-2.6.17/fs/cifs/readdir.c
===================================================================
--- linux-2.6.17.orig/fs/cifs/readdir.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/cifs/readdir.c	2006-06-18 19:53:54.000000000 -0400
@@ -197,10 +197,9 @@
 
 	if (allocation_size < end_of_file)
 		cFYI(1, ("May be sparse file, allocation less than file size"));
-	cFYI(1, ("File Size %ld and blocks %llu and blocksize %ld",
+	cFYI(1, ("File Size %ld and blocks %llu",
 		(unsigned long)tmp_inode->i_size,
-		(unsigned long long)tmp_inode->i_blocks,
-		tmp_inode->i_blksize));
+		(unsigned long long)tmp_inode->i_blocks));
 	if (S_ISREG(tmp_inode->i_mode)) {
 		cFYI(1, ("File inode"));
 		tmp_inode->i_op = &cifs_file_inode_ops;
Index: linux-2.6.17/fs/devfs/base.c
===================================================================
--- linux-2.6.17.orig/fs/devfs/base.c	2006-06-18 19:37:39.000000000 -0400
+++ linux-2.6.17/fs/devfs/base.c	2006-06-18 19:53:54.000000000 -0400
@@ -693,7 +693,6 @@
 #define FIRST_INODE 1
 
 #define STRING_LENGTH 256
-#define FAKE_BLOCK_SIZE 1024
 #define POISON_PTR ( *(void **) poison_array )
 #define MAGIC_VALUE 0x327db823
 
@@ -1925,7 +1924,6 @@
 	DPRINTK(DEBUG_I_GET, "(%d): VFS inode: %p  devfs_entry: %p\n",
 		(int)inode->i_ino, inode, de);
 	inode->i_blocks = 0;
-	inode->i_blksize = FAKE_BLOCK_SIZE;
 	inode->i_op = &devfs_iops;
 	inode->i_mode = de->mode;
 	if (S_ISDIR(de->mode)) {
Index: linux-2.6.17/fs/hugetlbfs/inode.c
===================================================================
--- linux-2.6.17.orig/fs/hugetlbfs/inode.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/hugetlbfs/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -361,7 +361,6 @@
 		inode->i_mode = mode;
 		inode->i_uid = uid;
 		inode->i_gid = gid;
-		inode->i_blksize = HPAGE_SIZE;
 		inode->i_blocks = 0;
 		inode->i_mapping->a_ops = &hugetlbfs_aops;
 		inode->i_mapping->backing_dev_info =&hugetlbfs_backing_dev_info;
@@ -678,6 +677,7 @@
 	sb->s_magic = HUGETLBFS_MAGIC;
 	sb->s_op = &hugetlbfs_ops;
 	sb->s_time_gran = 1;
+	sb->s_blksize = HPAGE_SIZE;
 	inode = hugetlbfs_get_inode(sb, config.uid, config.gid,
 					S_IFDIR | config.mode, 0);
 	if (!inode)
Index: linux-2.6.17/fs/jfs/jfs_extent.c
===================================================================
--- linux-2.6.17.orig/fs/jfs/jfs_extent.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/jfs/jfs_extent.c	2006-06-18 19:53:54.000000000 -0400
@@ -468,7 +468,7 @@
 int extFill(struct inode *ip, xad_t * xp)
 {
 	int rc, nbperpage = JFS_SBI(ip->i_sb)->nbperpage;
-	s64 blkno = offsetXAD(xp) >> ip->i_blksize;
+	s64 blkno = offsetXAD(xp) >> ip->i_blkbits;
 
 //      assert(ISSPARSE(ip));
 
Index: linux-2.6.17/fs/jfs/jfs_imap.c
===================================================================
--- linux-2.6.17.orig/fs/jfs/jfs_imap.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/jfs/jfs_imap.c	2006-06-18 19:53:54.000000000 -0400
@@ -3115,7 +3115,6 @@
 	ip->i_mtime.tv_nsec = le32_to_cpu(dip->di_mtime.tv_nsec);
 	ip->i_ctime.tv_sec = le32_to_cpu(dip->di_ctime.tv_sec);
 	ip->i_ctime.tv_nsec = le32_to_cpu(dip->di_ctime.tv_nsec);
-	ip->i_blksize = ip->i_sb->s_blocksize;
 	ip->i_blocks = LBLK2PBLK(ip->i_sb, le64_to_cpu(dip->di_nblocks));
 	ip->i_generation = le32_to_cpu(dip->di_gen);
 
Index: linux-2.6.17/fs/jfs/jfs_inode.c
===================================================================
--- linux-2.6.17.orig/fs/jfs/jfs_inode.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/jfs/jfs_inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -115,7 +115,6 @@
 	}
 	jfs_inode->mode2 |= mode;
 
-	inode->i_blksize = sb->s_blocksize;
 	inode->i_blocks = 0;
 	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
 	jfs_inode->otime = inode->i_ctime.tv_sec;
Index: linux-2.6.17/fs/jfs/jfs_metapage.c
===================================================================
--- linux-2.6.17.orig/fs/jfs/jfs_metapage.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/jfs/jfs_metapage.c	2006-06-18 19:53:54.000000000 -0400
@@ -257,7 +257,7 @@
 	int rc = 0;
 	int xflag;
 	s64 xaddr;
-	sector_t file_blocks = (inode->i_size + inode->i_blksize - 1) >>
+	sector_t file_blocks = (inode->i_size + inode->i_sb->s_blocksize - 1) >>
 			       inode->i_blkbits;
 
 	if (lblock >= file_blocks)
Index: linux-2.6.17/fs/ncpfs/inode.c
===================================================================
--- linux-2.6.17.orig/fs/ncpfs/inode.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/ncpfs/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -225,7 +225,6 @@
 	inode->i_nlink = 1;
 	inode->i_uid = server->m.uid;
 	inode->i_gid = server->m.gid;
-	inode->i_blksize = NCP_BLOCK_SIZE;
 
 	ncp_update_dates(inode, &nwinfo->i);
 	ncp_update_inode(inode, nwinfo);
@@ -493,6 +492,7 @@
 	sb->s_blocksize_bits = 10;
 	sb->s_magic = NCP_SUPER_MAGIC;
 	sb->s_op = &ncp_sops;
+	sb->s_blksize = NCP_BLOCK_SIZE;
 
 	server = NCP_SBP(sb);
 	memset(server, 0, sizeof(*server));
Index: linux-2.6.17/drivers/block/loop.c
===================================================================
--- linux-2.6.17.orig/drivers/block/loop.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/drivers/block/loop.c	2006-06-18 19:57:00.000000000 -0400
@@ -664,7 +664,8 @@
 
 	mapping_set_gfp_mask(old_file->f_mapping, lo->old_gfp_mask);
 	lo->lo_backing_file = file;
-	lo->lo_blocksize = mapping->host->i_blksize;
+	lo->lo_blocksize = S_ISBLK(mapping->host->i_mode) ?
+		mapping->host->i_bdev->bd_block_size : PAGE_SIZE;
 	lo->old_gfp_mask = mapping_gfp_mask(mapping);
 	mapping_set_gfp_mask(mapping, lo->old_gfp_mask & ~(__GFP_IO|__GFP_FS));
 	complete(&p->wait);
@@ -796,7 +797,9 @@
 		if (!(lo_flags & LO_FLAGS_USE_AOPS) && !file->f_op->write)
 			lo_flags |= LO_FLAGS_READ_ONLY;
 
-		lo_blocksize = inode->i_blksize;
+		lo_blocksize = S_ISBLK(inode->i_mode) ?
+			inode->i_bdev->bd_block_size : PAGE_SIZE;
+
 		error = 0;
 	} else {
 		goto out_putf;
Index: linux-2.6.17/fs/coda/coda_linux.c
===================================================================
--- linux-2.6.17.orig/fs/coda/coda_linux.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/coda/coda_linux.c	2006-06-18 19:53:54.000000000 -0400
@@ -110,8 +110,6 @@
 	        inode->i_nlink = attr->va_nlink;
 	if (attr->va_size != -1)
 	        inode->i_size = attr->va_size;
-	if (attr->va_blocksize != -1)
-		inode->i_blksize = attr->va_blocksize;
 	if (attr->va_size != -1)
 		inode->i_blocks = (attr->va_size + 511) >> 9;
 	if (attr->va_atime.tv_sec != -1) 
Index: linux-2.6.17/fs/smbfs/inode.c
===================================================================
--- linux-2.6.17.orig/fs/smbfs/inode.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/smbfs/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -168,7 +168,6 @@
 	fattr->f_mtime	= inode->i_mtime;
 	fattr->f_ctime	= inode->i_ctime;
 	fattr->f_atime	= inode->i_atime;
-	fattr->f_blksize= inode->i_blksize;
 	fattr->f_blocks	= inode->i_blocks;
 
 	fattr->attr	= SMB_I(inode)->attr;
@@ -202,7 +201,6 @@
 	inode->i_uid	= fattr->f_uid;
 	inode->i_gid	= fattr->f_gid;
 	inode->i_ctime	= fattr->f_ctime;
-	inode->i_blksize= fattr->f_blksize;
 	inode->i_blocks = fattr->f_blocks;
 	inode->i_size	= fattr->f_size;
 	inode->i_mtime	= fattr->f_mtime;
Index: linux-2.6.17/fs/smbfs/proc.c
===================================================================
--- linux-2.6.17.orig/fs/smbfs/proc.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/smbfs/proc.c	2006-06-18 19:53:54.000000000 -0400
@@ -1826,7 +1826,6 @@
 	fattr->f_nlink = 1;
 	fattr->f_uid = server->mnt->uid;
 	fattr->f_gid = server->mnt->gid;
-	fattr->f_blksize = SMB_ST_BLKSIZE;
 	fattr->f_unix = 0;
 }
 
Index: linux-2.6.17/include/linux/smb.h
===================================================================
--- linux-2.6.17.orig/include/linux/smb.h	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/include/linux/smb.h	2006-06-18 19:53:54.000000000 -0400
@@ -88,7 +88,6 @@
 	struct timespec	f_atime;
 	struct timespec f_mtime;
 	struct timespec f_ctime;
-	unsigned long	f_blksize;
 	unsigned long	f_blocks;
 	int		f_unix;
 };
Index: linux-2.6.17/fs/hostfs/hostfs_kern.c
===================================================================
--- linux-2.6.17.orig/fs/hostfs/hostfs_kern.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/hostfs/hostfs_kern.c	2006-06-18 19:53:54.000000000 -0400
@@ -156,7 +156,6 @@
 	ino->i_mode = i_mode;
 	ino->i_nlink = i_nlink;
 	ino->i_size = i_size;
-	ino->i_blksize = i_blksize;
 	ino->i_blocks = i_blocks;
 	return(0);
 }
Index: linux-2.6.17/fs/nfs/inode.c
===================================================================
--- linux-2.6.17.orig/fs/nfs/inode.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/nfs/inode.c	2006-06-18 19:53:54.000000000 -0400
@@ -910,10 +910,8 @@
 			 * report the blocks in 512byte units
 			 */
 			inode->i_blocks = nfs_calc_block_size(fattr->du.nfs3.used);
-			inode->i_blksize = inode->i_sb->s_blocksize;
 		} else {
 			inode->i_blocks = fattr->du.nfs2.blocks;
-			inode->i_blksize = fattr->du.nfs2.blocksize;
 		}
 		nfsi->attrtimeo = NFS_MINATTRTIMEO(inode);
 		nfsi->attrtimeo_timestamp = jiffies;
@@ -1606,10 +1604,8 @@
 		 * report the blocks in 512byte units
 		 */
 		inode->i_blocks = nfs_calc_block_size(fattr->du.nfs3.used);
-		inode->i_blksize = inode->i_sb->s_blocksize;
  	} else {
  		inode->i_blocks = fattr->du.nfs2.blocks;
- 		inode->i_blksize = fattr->du.nfs2.blocksize;
  	}
 
 	if ((fattr->valid & NFS_ATTR_FATTR_V4)) {
Index: linux-2.6.17/fs/xfs/linux-2.6/xfs_super.c
===================================================================
--- linux-2.6.17.orig/fs/xfs/linux-2.6/xfs_super.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/xfs/linux-2.6/xfs_super.c	2006-06-18 19:53:54.000000000 -0400
@@ -173,7 +173,6 @@
 		break;
 	}
 
-	inode->i_blksize = xfs_preferred_iosize(mp);
 	inode->i_generation = ip->i_d.di_gen;
 	i_size_write(inode, ip->i_d.di_size);
 	inode->i_blocks =
Index: linux-2.6.17/fs/xfs/linux-2.6/xfs_vnode.c
===================================================================
--- linux-2.6.17.orig/fs/xfs/linux-2.6/xfs_vnode.c	2006-06-18 19:37:14.000000000 -0400
+++ linux-2.6.17/fs/xfs/linux-2.6/xfs_vnode.c	2006-06-18 19:53:54.000000000 -0400
@@ -106,7 +106,6 @@
 	inode->i_blocks	    = vap->va_nblocks;
 	inode->i_mtime	    = vap->va_mtime;
 	inode->i_ctime	    = vap->va_ctime;
-	inode->i_blksize    = vap->va_blocksize;
 	if (vap->va_xflags & XFS_XFLAG_IMMUTABLE)
 		inode->i_flags |= S_IMMUTABLE;
 	else
Index: linux-2.6.17/drivers/infiniband/hw/ipath/ipath_fs.c
===================================================================
--- linux-2.6.17.orig/drivers/infiniband/hw/ipath/ipath_fs.c	2006-06-18 19:37:39.000000000 -0400
+++ linux-2.6.17/drivers/infiniband/hw/ipath/ipath_fs.c	2006-06-18 19:53:54.000000000 -0400
@@ -61,7 +61,6 @@
 	inode->i_mode = mode;
 	inode->i_uid = 0;
 	inode->i_gid = 0;
-	inode->i_blksize = PAGE_CACHE_SIZE;
 	inode->i_blocks = 0;
 	inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
 	inode->i_private = data;

--

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [RFC] [PATCH 6/8] inode-diet: Move i_cindex from struct inode to struct file
  2006-06-19 15:20 [RFC] [PATCH 0/8] Inode slimming Theodore Tso
                   ` (4 preceding siblings ...)
  2006-06-19 15:20 ` [RFC] [PATCH 5/8] inode-diet: Eliminate i_blksize and use a per-superblock default Theodore Tso
@ 2006-06-19 15:20 ` Theodore Tso
  2006-06-19 19:33   ` Al Viro
  2006-06-19 15:20 ` [RFC] [PATCH 7/8] inode-diet: Use a union for i_blocks and i_size, i_rdev and i_devices Theodore Tso
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 46+ messages in thread
From: Theodore Tso @ 2006-06-19 15:20 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: inode-slim-6 --]
[-- Type: text/plain, Size: 1964 bytes --]

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" <tytso@mit.edu>


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;

--

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [RFC] [PATCH 7/8] inode-diet: Use a union for i_blocks and i_size, i_rdev and i_devices
  2006-06-19 15:20 [RFC] [PATCH 0/8] Inode slimming Theodore Tso
                   ` (5 preceding siblings ...)
  2006-06-19 15:20 ` [RFC] [PATCH 6/8] inode-diet: Move i_cindex from struct inode to struct file Theodore Tso
@ 2006-06-19 15:20 ` Theodore Tso
  2006-06-19 15:20 ` [RFC] [PATCH 8/8] inode-diet: Fix size of i_blkbits, i_version, and i_dnotify_mask Theodore Tso
  2006-06-19 16:54 ` [RFC] [PATCH 0/8] Inode slimming Christoph Lameter
  8 siblings, 0 replies; 46+ messages in thread
From: Theodore Tso @ 2006-06-19 15:20 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: inode-slim-7 --]
[-- Type: text/plain, Size: 1404 bytes --]

The i_blocks and i_size fields are only used for regular files.  So we
move them into the union, along with i_rdev and i_devices, which are
only used by block or character devices.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>

Index: linux-2.6.17/include/linux/fs.h
===================================================================
--- linux-2.6.17.orig/include/linux/fs.h	2006-06-18 19:59:59.000000000 -0400
+++ linux-2.6.17/include/linux/fs.h	2006-06-19 07:29:36.000000000 -0400
@@ -486,15 +486,12 @@
 	unsigned int		i_nlink;
 	uid_t			i_uid;
 	gid_t			i_gid;
-	dev_t			i_rdev;
 	loff_t			i_size;
 	struct timespec		i_atime;
 	struct timespec		i_mtime;
 	struct timespec		i_ctime;
 	unsigned int		i_blkbits;
 	unsigned long		i_version;
-	blkcnt_t		i_blocks;
-	unsigned short          i_bytes;
 	spinlock_t		i_lock;	/* i_blocks, i_bytes, maybe i_size */
 	struct mutex		i_mutex;
 	struct rw_semaphore	i_alloc_sem;
@@ -507,11 +504,20 @@
 #ifdef CONFIG_QUOTA
 	struct dquot		*i_dquot[MAXQUOTAS];
 #endif
-	struct list_head	i_devices;
 	union {
 		struct pipe_inode_info	*i_pipe;
-		struct block_device	*i_bdev;
-		struct cdev		*i_cdev;
+		struct {
+			union {
+				struct block_device	*i_bdev;
+				struct cdev		*i_cdev;
+			};
+			dev_t			i_rdev;
+			struct list_head	i_devices;
+		};
+		struct {
+			unsigned short          i_bytes;
+			blkcnt_t		i_blocks;
+		};
 	};
 
 	__u32			i_generation;

--

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [RFC] [PATCH 8/8] inode-diet: Fix size of i_blkbits, i_version, and i_dnotify_mask
  2006-06-19 15:20 [RFC] [PATCH 0/8] Inode slimming Theodore Tso
                   ` (6 preceding siblings ...)
  2006-06-19 15:20 ` [RFC] [PATCH 7/8] inode-diet: Use a union for i_blocks and i_size, i_rdev and i_devices Theodore Tso
@ 2006-06-19 15:20 ` Theodore Tso
  2006-06-19 16:54 ` [RFC] [PATCH 0/8] Inode slimming Christoph Lameter
  8 siblings, 0 replies; 46+ messages in thread
From: Theodore Tso @ 2006-06-19 15:20 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: inode-slim-8 --]
[-- Type: text/plain, Size: 1400 bytes --]

i_blkbits stores the log n of the blocksize; there is no reason for it
to take more than 16 bits, so change it to be a short and put it next
to i_mode.

i_version and i_dnotify_mask need to be 32 bits, but there is no
reason for them to be 64-bit values on 64-bit architectures, so make
them be unsigned int's instead of unsigned long's.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>

Index: linux-2.6.17/include/linux/fs.h
===================================================================
--- linux-2.6.17.orig/include/linux/fs.h	2006-06-19 07:29:36.000000000 -0400
+++ linux-2.6.17/include/linux/fs.h	2006-06-19 07:48:02.000000000 -0400
@@ -483,6 +483,7 @@
 	unsigned long		i_ino;
 	atomic_t		i_count;
 	umode_t			i_mode;
+	unsigned short		i_blkbits;
 	unsigned int		i_nlink;
 	uid_t			i_uid;
 	gid_t			i_gid;
@@ -490,8 +491,7 @@
 	struct timespec		i_atime;
 	struct timespec		i_mtime;
 	struct timespec		i_ctime;
-	unsigned int		i_blkbits;
-	unsigned long		i_version;
+	unsigned int		i_version;
 	spinlock_t		i_lock;	/* i_blocks, i_bytes, maybe i_size */
 	struct mutex		i_mutex;
 	struct rw_semaphore	i_alloc_sem;
@@ -523,7 +523,7 @@
 	__u32			i_generation;
 
 #ifdef CONFIG_DNOTIFY
-	unsigned long		i_dnotify_mask; /* Directory notify events */
+	unsigned int		i_dnotify_mask; /* Directory notify events */
 	struct dnotify_struct	*i_dnotify; /* for directory notifications */
 #endif
 

--

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 5/8] inode-diet: Eliminate i_blksize and use a per-superblock default
  2006-06-19 15:20 ` [RFC] [PATCH 5/8] inode-diet: Eliminate i_blksize and use a per-superblock default Theodore Tso
@ 2006-06-19 15:49   ` Avi Kivity
  2006-06-19 16:55     ` Theodore Tso
  2006-06-19 15:58   ` Christoph Hellwig
  2006-06-19 16:01   ` Joel Becker
  2 siblings, 1 reply; 46+ messages in thread
From: Avi Kivity @ 2006-06-19 15:49 UTC (permalink / raw)
  To: Theodore Tso; +Cc: linux-kernel

Theodore Tso wrote:
>
> This eliminates the i_blksize field from struct inode and uses default
> value in super->s_blksize.  Filesystems that want to provide a
> per-inode st_blksize can do so by providing their own getattr routine
> instead of using the generic_fillattr() function.
>

> Index: linux-2.6.17/include/linux/nfsd/nfsfh.h
> ===================================================================
> --- linux-2.6.17.orig/include/linux/nfsd/nfsfh.h        2006-06-18 
> 19:37:14.000000000 -0400
> +++ linux-2.6.17/include/linux/nfsd/nfsfh.h     2006-06-18 
> 19:53:54.000000000 -0400
> @@ -270,8 +270,8 @@
>         fhp->fh_post_uid        = inode->i_uid;
>         fhp->fh_post_gid        = inode->i_gid;
>         fhp->fh_post_size       = inode->i_size;
> -       if (inode->i_blksize) {
> -               fhp->fh_post_blksize    = inode->i_blksize;
> +       if (inode->i_sb->s_blksize) {
> +               fhp->fh_post_blksize    = inode->i_sb->s_blksize;
>                 fhp->fh_post_blocks     = inode->i_blocks;
>         } else {
>                 fhp->fh_post_blksize    = BLOCK_SIZE;
>

Isn't this a behavioral change?  If a filesystem chooses to provide 
i_blksize via a getattr method, it will not show on nfs mounts.

-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 5/8] inode-diet: Eliminate i_blksize and use a per-superblock default
  2006-06-19 15:20 ` [RFC] [PATCH 5/8] inode-diet: Eliminate i_blksize and use a per-superblock default Theodore Tso
  2006-06-19 15:49   ` Avi Kivity
@ 2006-06-19 15:58   ` Christoph Hellwig
  2006-06-19 16:16     ` Joel Becker
  2006-06-19 17:03     ` Theodore Tso
  2006-06-19 16:01   ` Joel Becker
  2 siblings, 2 replies; 46+ messages in thread
From: Christoph Hellwig @ 2006-06-19 15:58 UTC (permalink / raw)
  To: Theodore Tso; +Cc: linux-kernel

On Mon, Jun 19, 2006 at 11:20:08AM -0400, Theodore Tso wrote:
> This eliminates the i_blksize field from struct inode and uses default
> value in super->s_blksize.  Filesystems that want to provide a
> per-inode st_blksize can do so by providing their own getattr routine
> instead of using the generic_fillattr() function.
> 
> Note that some filesystems were providing pretty much random (and
> incorrect) values for i_blksize.

Blease don't add a field to the superblock for the optimal I/O size.
Any filesystem that wants to override it can do so directly in ->getattr.


^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 5/8] inode-diet: Eliminate i_blksize and use a per-superblock default
  2006-06-19 15:20 ` [RFC] [PATCH 5/8] inode-diet: Eliminate i_blksize and use a per-superblock default Theodore Tso
  2006-06-19 15:49   ` Avi Kivity
  2006-06-19 15:58   ` Christoph Hellwig
@ 2006-06-19 16:01   ` Joel Becker
  2006-06-19 17:06     ` Theodore Tso
  2 siblings, 1 reply; 46+ messages in thread
From: Joel Becker @ 2006-06-19 16:01 UTC (permalink / raw)
  To: Theodore Tso; +Cc: linux-kernel

On Mon, Jun 19, 2006 at 11:20:08AM -0400, Theodore Tso wrote:
> Index: linux-2.6.17/fs/ocfs2/super.c
> ===================================================================
> --- linux-2.6.17.orig/fs/ocfs2/super.c	2006-06-18 19:37:14.000000000 -0400
> +++ linux-2.6.17/fs/ocfs2/super.c	2006-06-18 19:53:54.000000000 -0400
> @@ -1390,7 +1390,7 @@
>  	/* get some pseudo constants for clustersize bits */
>  	osb->s_clustersize_bits =
>  		le32_to_cpu(di->id2.i_super.s_clustersize_bits);
> -	osb->s_clustersize = 1 << osb->s_clustersize_bits;
> +	osb->s_blksize = osb->s_clustersize = 1 << osb->s_clustersize_bits;

	I assume you meant sb->s_blksize.  osb is a private structure
hanging off of sb->s_fs_info.
	I have to say, having sb->s_blocksize and sb->s_blksize might be
a little confusing.

Joel

-- 

"Heav'n hath no rage like love to hatred turn'd, nor Hell a fury,
 like a woman scorn'd."
        - William Congreve

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 5/8] inode-diet: Eliminate i_blksize and use a per-superblock default
  2006-06-19 15:58   ` Christoph Hellwig
@ 2006-06-19 16:16     ` Joel Becker
  2006-06-19 17:20       ` Theodore Tso
  2006-06-19 17:03     ` Theodore Tso
  1 sibling, 1 reply; 46+ messages in thread
From: Joel Becker @ 2006-06-19 16:16 UTC (permalink / raw)
  To: Christoph Hellwig, Theodore Tso, linux-kernel

On Mon, Jun 19, 2006 at 04:58:21PM +0100, Christoph Hellwig wrote:
> Blease don't add a field to the superblock for the optimal I/O size.
> Any filesystem that wants to override it can do so directly in ->getattr.

	I don't disagree with you, but the idea of everyone implementing
->getattr where they just let it work before scares me.  It's a ton of
cut-n-paste error waiting to happen.  Especially if we make something
stale.
	Perhaps add generic_fillattr_blksize()?

myfs_fillattr(inode, stat)
{
    generic_fillattr_size(inode, myfavoriteblksize, stat)
}

Joel

-- 

Life's Little Instruction Book #407

	"Every once in a while, take the scenic route."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 0/8] Inode slimming
  2006-06-19 15:20 [RFC] [PATCH 0/8] Inode slimming Theodore Tso
                   ` (7 preceding siblings ...)
  2006-06-19 15:20 ` [RFC] [PATCH 8/8] inode-diet: Fix size of i_blkbits, i_version, and i_dnotify_mask Theodore Tso
@ 2006-06-19 16:54 ` Christoph Lameter
  2006-06-19 19:09   ` Theodore Tso
  8 siblings, 1 reply; 46+ messages in thread
From: Christoph Lameter @ 2006-06-19 16:54 UTC (permalink / raw)
  To: Theodore Tso; +Cc: linux-kernel

On Mon, 19 Jun 2006, Theodore Tso wrote:

> What else remains to be done?  There are a large number of fields in
> struct inode which are never populated unless the inode is open, and
> those should get moved into another structure which is populated only
> when needed.  There are a large number of inodes which are read into
> memory only because stat(2) was called on them (thanks to things like
> color ls, et. al).  

One could remove the reclaim list and use the slab lists of the slab 
allocator to scan through the inodes and reclaim them in such a way
that would maximize the number of pages freed. I will post an RFC on that 
one later. This may reduce the complexity of inode reclaim.


^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 5/8] inode-diet: Eliminate i_blksize and use a per-superblock default
  2006-06-19 15:49   ` Avi Kivity
@ 2006-06-19 16:55     ` Theodore Tso
  0 siblings, 0 replies; 46+ messages in thread
From: Theodore Tso @ 2006-06-19 16:55 UTC (permalink / raw)
  To: Avi Kivity; +Cc: linux-kernel

On Mon, Jun 19, 2006 at 06:49:22PM +0300, Avi Kivity wrote:
> 
> Isn't this a behavioral change?  If a filesystem chooses to provide 
> i_blksize via a getattr method, it will not show on nfs mounts.

There's actually a philosophical question hiding here over what's the
right thing to do with how st_blksize should be handled over NFS ---
st_blksize is supposed to be the "optimum I/O size"; the question is
what is the right answer that we report in both directions.  For
example, it doesn't matter if we're exporting a Ultra Fast whiz-bang
cluster filesystem with a stripsize of 100 gigabytes.  If wsize is
1024, it might be that we shouldn't be sending back an st_blksize
that's really big.

So I'm not pretending that what we have in the patch is the right
thing, only that I'm not entirely sure we were ever doing the right
thing here.

						- Ted

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 5/8] inode-diet: Eliminate i_blksize and use a per-superblock default
  2006-06-19 15:58   ` Christoph Hellwig
  2006-06-19 16:16     ` Joel Becker
@ 2006-06-19 17:03     ` Theodore Tso
  2006-06-19 18:56       ` Christoph Hellwig
  1 sibling, 1 reply; 46+ messages in thread
From: Theodore Tso @ 2006-06-19 17:03 UTC (permalink / raw)
  To: Christoph Hellwig, linux-kernel

On Mon, Jun 19, 2006 at 04:58:21PM +0100, Christoph Hellwig wrote:
> On Mon, Jun 19, 2006 at 11:20:08AM -0400, Theodore Tso wrote:
> > This eliminates the i_blksize field from struct inode and uses default
> > value in super->s_blksize.  Filesystems that want to provide a
> > per-inode st_blksize can do so by providing their own getattr routine
> > instead of using the generic_fillattr() function.
> > 
> > Note that some filesystems were providing pretty much random (and
> > incorrect) values for i_blksize.
> 
> Blease don't add a field to the superblock for the optimal I/O size.
> Any filesystem that wants to override it can do so directly in ->getattr.

I was mainly adding a field to the superblock for the sake of
reiserfs; it was the easiest way to support it's current insanity of
reporting 128megs as st_blksize, but with a mount option that affected
things on a global scale.  (Hey, at least my patch made resierfs
support the mount option as a per-superblock setting, instead of
setting a global variable that changed the behaviour for all mounts.)

I don't mind espceially removing the superblock field, but if we do, I
refuse to mess with adding a getattr special for reiserfs; someone who
wants to support its current behaviour is free to send me or LKML
patches....


						- Ted

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 5/8] inode-diet: Eliminate i_blksize and use a per-superblock default
  2006-06-19 16:01   ` Joel Becker
@ 2006-06-19 17:06     ` Theodore Tso
  2006-06-19 21:45       ` Joel Becker
  2006-06-19 22:14       ` Mark Fasheh
  0 siblings, 2 replies; 46+ messages in thread
From: Theodore Tso @ 2006-06-19 17:06 UTC (permalink / raw)
  To: linux-kernel

On Mon, Jun 19, 2006 at 09:01:46AM -0700, Joel Becker wrote:
> 
> 	I assume you meant sb->s_blksize.  osb is a private structure
> hanging off of sb->s_fs_info.

Yep, mea culpa.

> 	I have to say, having sb->s_blocksize and sb->s_blksize might be
> a little confusing.

How strongly do you feel about reporting stat.st_blksize out to be the
clustersize?  Keeping in mind that if you report a value which is too
big, /bin/cp will start coredumping....

If I take Christoph's suggestion of simply removing sb->s_blksize
altogether, and forcing filesystems that want to return a non-default
value for stat.st_blksize to supply their own filesystem-specific
getattr, will you mind terribly?

						- Ted

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 1/8] inode_diet: Replace inode.u.generic_ip with inode.i_private
  2006-06-19 15:20 ` [RFC] [PATCH 1/8] inode_diet: Replace inode.u.generic_ip with inode.i_private Theodore Tso
@ 2006-06-19 17:17   ` Jan Engelhardt
  2006-06-19 19:09   ` Christoph Hellwig
  2006-06-20  9:43   ` Steven Whitehouse
  2 siblings, 0 replies; 46+ messages in thread
From: Jan Engelhardt @ 2006-06-19 17:17 UTC (permalink / raw)
  To: Theodore Tso; +Cc: linux-kernel


>--- linux-2.6.17.orig/arch/s390/kernel/debug.c	2006-06-18 18:58:51.000000000 -0400
>+++ linux-2.6.17/arch/s390/kernel/debug.c	2006-06-18 18:58:55.000000000 -0400
>@@ -604,7 +604,7 @@
> 	debug_info_t *debug_info, *debug_info_snapshot;
> 
> 	down(&debug_lock);
>-	debug_info = (struct debug_info*)file->f_dentry->d_inode->u.generic_ip;
>+	debug_info = (struct debug_info*)file->f_dentry->d_inode->i_private;

All these casts can be removed at the same time,
since i_private is a void* anyway and therefore does not require casting.

>-	rhbeat->sp = (struct service_processor *)inode->u.generic_ip;
>+	rhbeat->sp = (struct service_processor *)inode->i_private;


>-	char *s=((struct autofs_symlink *)dentry->d_inode->u.generic_ip)->data;
>+	char *s=((struct autofs_symlink *)dentry->d_inode->i_private)->data;

>-	VERIFY_ENTRY((struct devfs_entry *)inode->u.generic_ip);
>-	return inode->u.generic_ip;
>+	VERIFY_ENTRY((struct devfs_entry *)inode->i_private);
>+	return inode->i_private;

> #define VXFS_INO(ip) \
>-	((struct vxfs_inode_info *)(ip)->u.generic_ip)
>+	((struct vxfs_inode_info *)(ip)->i_private)
Depends on use of VXFS_INO here.

>-	ip->u.generic_ip = (void *)vip;
>+	ip->i_private = (void *)vip;

>-	inode->u.generic_ip = (void *)f;
>+	inode->i_private = (void *)f;

>-	if (!(old_dir_f = (struct jffs_file *)old_dir->u.generic_ip)) {
>+	if (!(old_dir_f = (struct jffs_file *)old_dir->i_private)) {
Not sure.

>-	if (!(new_dir_f = (struct jffs_file *)new_dir->u.generic_ip)) {
>+	if (!(new_dir_f = (struct jffs_file *)new_dir->i_private)) {

>-	if (!(d = (struct jffs_file *)dir->u.generic_ip)) {
>+	if (!(d = (struct jffs_file *)dir->i_private)) {

>-	struct jffs_file *f = (struct jffs_file *)inode->u.generic_ip;
>+	struct jffs_file *f = (struct jffs_file *)inode->i_private;
> 	struct jffs_control *c = (struct jffs_control *)inode->i_sb->s_fs_info;

>-	dir_f = (struct jffs_file *)dir->u.generic_ip;
>+	dir_f = (struct jffs_file *)dir->i_private;

>-	dir_f = (struct jffs_file *) dir->u.generic_ip;
>+	dir_f = (struct jffs_file *) dir->i_private;

>-	dir_f = (struct jffs_file *)dir->u.generic_ip;
>+	dir_f = (struct jffs_file *)dir->i_private;

>-	dir_f = (struct jffs_file *)dir->u.generic_ip;
>+	dir_f = (struct jffs_file *)dir->i_private;

>-	dir_f = (struct jffs_file *)dir->u.generic_ip;
>+	dir_f = (struct jffs_file *)dir->i_private;

>-	if (!(f = (struct jffs_file *)inode->u.generic_ip)) {
>-		D(printk("jffs_file_write(): inode->u.generic_ip = 0x%p\n",
>-				inode->u.generic_ip));
>+	if (!(f = (struct jffs_file *)inode->i_private)) {
>+		D(printk("jffs_file_write(): inode->i_private = 0x%p\n",
>+				inode->i_private));

>-	inode->u.generic_ip = (void *)f;
>+	inode->i_private = (void *)f;

lots more.


Jan Engelhardt
-- 

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 2/8] inode-diet: Move i_pipe into a union
  2006-06-19 15:20 ` [RFC] [PATCH 2/8] inode-diet: Move i_pipe into a union Theodore Tso
@ 2006-06-19 17:19   ` Jan Engelhardt
  2006-06-19 19:06     ` Theodore Tso
  0 siblings, 1 reply; 46+ messages in thread
From: Jan Engelhardt @ 2006-06-19 17:19 UTC (permalink / raw)
  To: Theodore Tso; +Cc: linux-kernel


>Move the i_pipe pointer into a union that will be shared with i_bdev
>and i_cdev.

>+	union {
>+		struct pipe_inode_info	*i_pipe;
>+	};

Since in the next patch you did

-       if (inode->i_bdev)
+       if (S_ISBLK(inode->i_mode) && inode->i_bdev)

I am just asking, for clarity, if there were any similar lines for 
pipes that should now read S_IFIFO(inode->i_mode) too, like for bdevs.


Jan Engelhardt
-- 

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 5/8] inode-diet: Eliminate i_blksize and use a per-superblock default
  2006-06-19 16:16     ` Joel Becker
@ 2006-06-19 17:20       ` Theodore Tso
  2006-06-19 18:55         ` Christoph Hellwig
  2006-06-21 19:41         ` Nate Diller
  0 siblings, 2 replies; 46+ messages in thread
From: Theodore Tso @ 2006-06-19 17:20 UTC (permalink / raw)
  To: Christoph Hellwig, linux-kernel

On Mon, Jun 19, 2006 at 09:16:51AM -0700, Joel Becker wrote:
> On Mon, Jun 19, 2006 at 04:58:21PM +0100, Christoph Hellwig wrote:
> > Blease don't add a field to the superblock for the optimal I/O size.
> > Any filesystem that wants to override it can do so directly in ->getattr.
> 
> 	I don't disagree with you, but the idea of everyone implementing
> ->getattr where they just let it work before scares me.  It's a ton of
> cut-n-paste error waiting to happen.  Especially if we make something
> stale.
> 	Perhaps add generic_fillattr_blksize()?

Well, as far as I know the only filesystems today that would need to
do something different are xfs, ocfs2, and reiserfs, and IMHO only the
first two have any kind of justification for doing it.  Part of the
problem is what st_blksize actually means was never well-defined; it
was never in POSIX, and in SuSv3 all that is stated is, "A file
system-specific preferred I/O block size for this object."  This is
why Reiserfs got away with specifying 128 megs (I assume it helped on
some benchmark), and why being ill-defined, using such a large value
might cause some applications (like /bin/cp) to core dump.   

Given that most filesystems use the generic page cache read/write
functions, using PAGE_CACHE_SIZE as the default seems to make a huge
amount of sense.  I really wonder how useful setting st_blksize really
is, actually, at least in the real-world, as opposed to just for
benchmarks.

						- Ted

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 4/8] inode-diet: Move i_cdev into a union
  2006-06-19 15:20 ` [RFC] [PATCH 4/8] inode-diet: Move i_cdev " Theodore Tso
@ 2006-06-19 17:20   ` Jan Engelhardt
  0 siblings, 0 replies; 46+ messages in thread
From: Jan Engelhardt @ 2006-06-19 17:20 UTC (permalink / raw)
  To: Theodore Tso; +Cc: linux-kernel


>===================================================================
>--- linux-2.6.17.orig/fs/file_table.c	2006-06-18 19:37:14.000000000 -0400
>+++ linux-2.6.17/fs/file_table.c	2006-06-18 19:50:56.000000000 -0400
>@@ -170,7 +170,7 @@
> 	if (file->f_op && file->f_op->release)
> 		file->f_op->release(inode, file);
> 	security_file_free(file);
>-	if (unlikely(inode->i_cdev != NULL))
>+	if (unlikely(S_ISCHR(inode->i_mode) && (inode->i_cdev != NULL)))

Am I allowed to be nitpicky? If so, drop the () around inode->i_cdev != 
NULL. :)



Jan Engelhardt
-- 

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 5/8] inode-diet: Eliminate i_blksize and use a per-superblock default
  2006-06-19 17:20       ` Theodore Tso
@ 2006-06-19 18:55         ` Christoph Hellwig
  2006-06-19 22:13           ` Mark Fasheh
  2006-06-21 19:41         ` Nate Diller
  1 sibling, 1 reply; 46+ messages in thread
From: Christoph Hellwig @ 2006-06-19 18:55 UTC (permalink / raw)
  To: Theodore Tso, Christoph Hellwig, linux-kernel

On Mon, Jun 19, 2006 at 01:20:14PM -0400, Theodore Tso wrote:
> On Mon, Jun 19, 2006 at 09:16:51AM -0700, Joel Becker wrote:
> > On Mon, Jun 19, 2006 at 04:58:21PM +0100, Christoph Hellwig wrote:
> > > Blease don't add a field to the superblock for the optimal I/O size.
> > > Any filesystem that wants to override it can do so directly in ->getattr.
> > 
> > 	I don't disagree with you, but the idea of everyone implementing
> > ->getattr where they just let it work before scares me.  It's a ton of
> > cut-n-paste error waiting to happen.  Especially if we make something
> > stale.
> > 	Perhaps add generic_fillattr_blksize()?
> 
> Well, as far as I know the only filesystems today that would need to
> do something different are xfs, ocfs2, and reiserfs,

And to answer Joel's statment of these three two already implement their
own ->getattr.  Also it doesn't mean a filesystem has to completely
reimplement it, they just have to override it by reusing generic_fillattr,
e.g.

static int my_getattr(struct vfsmount *mnt, struct dentry *dentry,
		struct kstat *stat)
{
	int error = generic_fillattr(dentry->d_inode, stat);
	if (!error)
		stat->blksize = something_useful;
	return error;
}		

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 5/8] inode-diet: Eliminate i_blksize and use a per-superblock default
  2006-06-19 17:03     ` Theodore Tso
@ 2006-06-19 18:56       ` Christoph Hellwig
  0 siblings, 0 replies; 46+ messages in thread
From: Christoph Hellwig @ 2006-06-19 18:56 UTC (permalink / raw)
  To: Theodore Tso, Christoph Hellwig, linux-kernel

On Mon, Jun 19, 2006 at 01:03:38PM -0400, Theodore Tso wrote:
> I was mainly adding a field to the superblock for the sake of
> reiserfs; it was the easiest way to support it's current insanity of
> reporting 128megs as st_blksize, but with a mount option that affected
> things on a global scale.  (Hey, at least my patch made resierfs
> support the mount option as a per-superblock setting, instead of
> setting a global variable that changed the behaviour for all mounts.)
> 
> I don't mind espceially removing the superblock field, but if we do, I
> refuse to mess with adding a getattr special for reiserfs; someone who
> wants to support its current behaviour is free to send me or LKML
> patches....

I'd suggest to either keep their current buggy behaviour and let Hans fix
it or use a field in the reiserfs specific superblock structure.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 2/8] inode-diet: Move i_pipe into a union
  2006-06-19 17:19   ` Jan Engelhardt
@ 2006-06-19 19:06     ` Theodore Tso
  2006-06-20 15:23       ` Brian F. G. Bidulock
  0 siblings, 1 reply; 46+ messages in thread
From: Theodore Tso @ 2006-06-19 19:06 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: linux-kernel

On Mon, Jun 19, 2006 at 07:19:26PM +0200, Jan Engelhardt wrote:
> 
> >Move the i_pipe pointer into a union that will be shared with i_bdev
> >and i_cdev.
> 
> >+	union {
> >+		struct pipe_inode_info	*i_pipe;
> >+	};
> 
> Since in the next patch you did
> 
> -       if (inode->i_bdev)
> +       if (S_ISBLK(inode->i_mode) && inode->i_bdev)
> 
> I am just asking, for clarity, if there were any similar lines for 
> pipes that should now read S_IFIFO(inode->i_mode) too, like for bdevs.

Nope, I didn't see any, and I did audit all of the places that used
i_pipe.  At least in the mainline kernel, all of the places which used
i_pipe were in places were we knew already that we were dealing with a
pipe.  

As was mentioned in earlier comment, this will be problematic for the
out-of-tree System V Streams code, which hijacks i_pipe as another
place to store 4 bytes of random data needed for the Streams code (I
believe they needed a pointer to the stream head -- the v_str pointer
in a legacy Unix system's inode).  But, that is an out-of-tree kernel
module, and it's a clear abuse of the i_pipe element in any case.

							- Ted

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 1/8] inode_diet: Replace inode.u.generic_ip with inode.i_private
  2006-06-19 15:20 ` [RFC] [PATCH 1/8] inode_diet: Replace inode.u.generic_ip with inode.i_private Theodore Tso
  2006-06-19 17:17   ` Jan Engelhardt
@ 2006-06-19 19:09   ` Christoph Hellwig
  2006-06-19 19:37     ` Theodore Tso
  2006-06-20  9:43   ` Steven Whitehouse
  2 siblings, 1 reply; 46+ messages in thread
From: Christoph Hellwig @ 2006-06-19 19:09 UTC (permalink / raw)
  To: Theodore Tso; +Cc: linux-kernel, linux390

> Index: linux-2.6.17/arch/s390/kernel/debug.c
> ===================================================================
> --- linux-2.6.17.orig/arch/s390/kernel/debug.c	2006-06-18 18:58:51.000000000 -0400
> +++ linux-2.6.17/arch/s390/kernel/debug.c	2006-06-18 18:58:55.000000000 -0400
> @@ -604,7 +604,7 @@
>  	debug_info_t *debug_info, *debug_info_snapshot;
>  
>  	down(&debug_lock);
> -	debug_info = (struct debug_info*)file->f_dentry->d_inode->u.generic_ip;
> +	debug_info = (struct debug_info*)file->f_dentry->d_inode->i_private;

is this actually okay?  who owns the private data in debugfs inodes?


^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 0/8] Inode slimming
  2006-06-19 16:54 ` [RFC] [PATCH 0/8] Inode slimming Christoph Lameter
@ 2006-06-19 19:09   ` Theodore Tso
  0 siblings, 0 replies; 46+ messages in thread
From: Theodore Tso @ 2006-06-19 19:09 UTC (permalink / raw)
  To: Christoph Lameter; +Cc: linux-kernel

On Mon, Jun 19, 2006 at 09:54:22AM -0700, Christoph Lameter wrote:
> On Mon, 19 Jun 2006, Theodore Tso wrote:
> 
> > What else remains to be done?  There are a large number of fields in
> > struct inode which are never populated unless the inode is open, and
> > those should get moved into another structure which is populated only
> > when needed.  There are a large number of inodes which are read into
> > memory only because stat(2) was called on them (thanks to things like
> > color ls, et. al).  
> 
> One could remove the reclaim list and use the slab lists of the slab 
> allocator to scan through the inodes and reclaim them in such a way
> that would maximize the number of pages freed. I will post an RFC on that 
> one later. This may reduce the complexity of inode reclaim.

That may very well be a good thing to do (although if it is too
aggressive we may end up reducing the utility of the dentry cache ---
your patch is going to try to free the dentries pinning inodes, right?
Otherwise it will probably not have much effect), but I think that's a
largely orthogonal issue.  It will still be good to be able to cache
inodes (and dentries), but it would be desireable if we can do this in
less memory than it currently takes, and separating out those fields
which are only needed when the inode is opened, or when its pages are
cached in the page cache, would be a good way of minimizing the
footprint of inodes who only needs to have their stat(2) information
cached.

Regards,

						- Ted


^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 6/8] inode-diet: Move i_cindex from struct inode to struct file
  2006-06-19 15:20 ` [RFC] [PATCH 6/8] inode-diet: Move i_cindex from struct inode to struct file Theodore Tso
@ 2006-06-19 19:33   ` Al Viro
  2006-06-19 19:37     ` Al Viro
  0 siblings, 1 reply; 46+ messages in thread
From: Al Viro @ 2006-06-19 19:33 UTC (permalink / raw)
  To: Theodore Tso; +Cc: linux-kernel

On Mon, Jun 19, 2006 at 11:20:09AM -0400, Theodore Tso wrote:
> 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.

NAK.  Please, take it to the union into cdev part.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 1/8] inode_diet: Replace inode.u.generic_ip with inode.i_private
  2006-06-19 19:09   ` Christoph Hellwig
@ 2006-06-19 19:37     ` Theodore Tso
  0 siblings, 0 replies; 46+ messages in thread
From: Theodore Tso @ 2006-06-19 19:37 UTC (permalink / raw)
  To: Christoph Hellwig, linux-kernel, linux390

On Mon, Jun 19, 2006 at 08:09:22PM +0100, Christoph Hellwig wrote:
> > Index: linux-2.6.17/arch/s390/kernel/debug.c
> > ===================================================================
> > --- linux-2.6.17.orig/arch/s390/kernel/debug.c	2006-06-18 18:58:51.000000000 -0400
> > +++ linux-2.6.17/arch/s390/kernel/debug.c	2006-06-18 18:58:55.000000000 -0400
> > @@ -604,7 +604,7 @@
> >  	debug_info_t *debug_info, *debug_info_snapshot;
> >  
> >  	down(&debug_lock);
> > -	debug_info = (struct debug_info*)file->f_dentry->d_inode->u.generic_ip;
> > +	debug_info = (struct debug_info*)file->f_dentry->d_inode->i_private;
> 
> is this actually okay?  who owns the private data in debugfs inodes?

debugfs allows the caller of debugfs_create_file() to pass in private
data.  So this in fact the intended way it's supposed to work AFAIK.
The s/390 debug facility passed in a struct debug_info * in
debug_register_view()'s call to debugfs_create_file, and it pulls it
out again in debug_open() (in the above referenced patch).

						- Ted

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 6/8] inode-diet: Move i_cindex from struct inode to struct file
  2006-06-19 19:33   ` Al Viro
@ 2006-06-19 19:37     ` Al Viro
  2006-06-19 20:58       ` Theodore Tso
  0 siblings, 1 reply; 46+ messages in thread
From: Al Viro @ 2006-06-19 19:37 UTC (permalink / raw)
  To: Theodore Tso; +Cc: linux-kernel

On Mon, Jun 19, 2006 at 08:33:35PM +0100, Al Viro wrote:
> On Mon, Jun 19, 2006 at 11:20:09AM -0400, Theodore Tso wrote:
> > 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.
> 
> NAK.  Please, take it to the union into cdev part.

Explanation: the whole point of that sucker is to avoid i_rdev use
in drivers, switching to i_cdev + i_cindex.  _Especially_ in open().
There is a bunch of other drivers that would get cleaner from that,
including a lot of tty code.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 6/8] inode-diet: Move i_cindex from struct inode to struct file
  2006-06-19 19:37     ` Al Viro
@ 2006-06-19 20:58       ` Theodore Tso
  2006-06-19 21:51         ` Stefan Richter
  0 siblings, 1 reply; 46+ messages in thread
From: Theodore Tso @ 2006-06-19 20:58 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-kernel

On Mon, Jun 19, 2006 at 08:37:56PM +0100, Al Viro wrote:
> > NAK.  Please, take it to the union into cdev part.
> 
> Explanation: the whole point of that sucker is to avoid i_rdev use
> in drivers, switching to i_cdev + i_cindex.  _Especially_ in open().
> There is a bunch of other drivers that would get cleaner from that,
> including a lot of tty code.

The problem is that we already have more stuff in the cdev union
(list_head's are *big*, especially on Opterons), so moving it there
doesn't actually save us anything.

Moving it into struct file however should be good enough clean up the
character devices drivers that you are concerned about, however.  They
are passed the struct file pointer in the file_operations->open call.
So we can clean up the tty code, et. al, by using file->f_cindex just
as easily.  

Furthermore, the inode->i_cindex isn't guaranteed to be valid until
the high-level vfs open code is called anyway, so you might as well
tell people to reference it from filp->f_cindex in the device driver's
open() routine.

Does that make sense?

						- Ted

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 5/8] inode-diet: Eliminate i_blksize and use a per-superblock default
  2006-06-19 17:06     ` Theodore Tso
@ 2006-06-19 21:45       ` Joel Becker
  2006-06-19 22:14       ` Mark Fasheh
  1 sibling, 0 replies; 46+ messages in thread
From: Joel Becker @ 2006-06-19 21:45 UTC (permalink / raw)
  To: Theodore Tso, linux-kernel; +Cc: mark.fasheh

On Mon, Jun 19, 2006 at 01:06:27PM -0400, Theodore Tso wrote:
> How strongly do you feel about reporting stat.st_blksize out to be the
> clustersize?  Keeping in mind that if you report a value which is too
> big, /bin/cp will start coredumping....

	What's "too big"?  We certainly don't specify 128MB, but we will
specify up to 1MB.
	When we have large cluster size filesystems, we've seen backups
with O_DIRECT-enabled versions of cp(1) and dd(1) go way faster than
when they read/write 4K at a time.  This matters to folks who have the
files open O_DIRECT by other processes and cannot trust the page cache.
At least, that's is how it was when we originally did this :-)

> If I take Christoph's suggestion of simply removing sb->s_blksize
> altogether, and forcing filesystems that want to return a non-default
> value for stat.st_blksize to supply their own filesystem-specific
> getattr, will you mind terribly?

	Well, Christoph points out we already have a valid getattr()
that calls generic_fillattr() and then overloads our stat->blksize.  So
I think we're safe.  I don't think we need sb->s_blksize, but I'll defer
to Mark for the final say.

Joel

-- 

"The lawgiver, of all beings, most owes the law allegiance.  He of all
 men should behave as though the law compelled him.  But it is the
 universal weakness of mankind that what we are given to administer we
 presently imagine we own."
        - H.G. Wells

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 6/8] inode-diet: Move i_cindex from struct inode to struct file
  2006-06-19 20:58       ` Theodore Tso
@ 2006-06-19 21:51         ` Stefan Richter
  0 siblings, 0 replies; 46+ messages in thread
From: Stefan Richter @ 2006-06-19 21:51 UTC (permalink / raw)
  To: Theodore Tso; +Cc: Al Viro, linux-kernel

Theodore Tso wrote:
> On Mon, Jun 19, 2006 at 08:37:56PM +0100, Al Viro wrote:
>>>NAK.  Please, take it to the union into cdev part.
>>
>>Explanation: the whole point of that sucker is to avoid i_rdev use
>>in drivers, switching to i_cdev + i_cindex.  _Especially_ in open().
>>There is a bunch of other drivers that would get cleaner from that,
>>including a lot of tty code.
> 
> The problem is that we already have more stuff in the cdev union
> (list_head's are *big*, especially on Opterons), so moving it there
> doesn't actually save us anything.
> 
> Moving it into struct file however should be good enough clean up the
> character devices drivers that you are concerned about, however.  They
> are passed the struct file pointer in the file_operations->open call.
> So we can clean up the tty code, et. al, by using file->f_cindex just
> as easily.  
> 
> Furthermore, the inode->i_cindex isn't guaranteed to be valid until
> the high-level vfs open code is called anyway, so you might as well
> tell people to reference it from filp->f_cindex in the device driver's
> open() routine.
> 
> Does that make sense?

The patch is obviously proper for usage by any file_operations->open() 
users like the single current one (or two actually, dv1394_open() and 
video1394_open()). I don't know if there are any contrary usages planned 
in other subsystems.
-- 
Stefan Richter
-=====-=-==- -==- =--==
http://arcgraph.de/sr/

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 5/8] inode-diet: Eliminate i_blksize and use a per-superblock default
  2006-06-19 18:55         ` Christoph Hellwig
@ 2006-06-19 22:13           ` Mark Fasheh
  0 siblings, 0 replies; 46+ messages in thread
From: Mark Fasheh @ 2006-06-19 22:13 UTC (permalink / raw)
  To: Christoph Hellwig, Theodore Tso, linux-kernel

On Mon, Jun 19, 2006 at 07:55:55PM +0100, Christoph Hellwig wrote:
> And to answer Joel's statment of these three two already implement their
> own ->getattr.  Also it doesn't mean a filesystem has to completely
> reimplement it, they just have to override it by reusing generic_fillattr,
> e.g.
And actually, that's what we do in ocfs2_getattr() today already:

	generic_fillattr(inode, stat);

	/* We set the blksize from the cluster size for performance */
	stat->blksize = osb->s_clustersize;

Thanks,
	--Mark
--
Mark Fasheh
Senior Software Developer, Oracle
mark.fasheh@oracle.com

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 5/8] inode-diet: Eliminate i_blksize and use a per-superblock default
  2006-06-19 17:06     ` Theodore Tso
  2006-06-19 21:45       ` Joel Becker
@ 2006-06-19 22:14       ` Mark Fasheh
  1 sibling, 0 replies; 46+ messages in thread
From: Mark Fasheh @ 2006-06-19 22:14 UTC (permalink / raw)
  To: Theodore Tso, linux-kernel

On Mon, Jun 19, 2006 at 01:06:27PM -0400, Theodore Tso wrote:
> How strongly do you feel about reporting stat.st_blksize out to be the
> clustersize?  Keeping in mind that if you report a value which is too
> big, /bin/cp will start coredumping....
Any idea on what constitutes "too big"? We could always cap things at some
reasonable maximum. AFAIR, the reason it's set to clustersize these days is
because it actually made a performance impact on large file operations -
backing up a data base file, for example.

> If I take Christoph's suggestion of simply removing sb->s_blksize
> altogether, and forcing filesystems that want to return a non-default
> value for stat.st_blksize to supply their own filesystem-specific
> getattr, will you mind terribly?
No, I don't mind really - it's a minor bit of code and it'll save us all
some space on the super block structure. I assume we can just continue to
follow Christoph's suggestion in ocfs2_getattr().
	--Mark

--
Mark Fasheh
Senior Software Developer, Oracle
mark.fasheh@oracle.com

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 1/8] inode_diet: Replace inode.u.generic_ip with inode.i_private
  2006-06-19 15:20 ` [RFC] [PATCH 1/8] inode_diet: Replace inode.u.generic_ip with inode.i_private Theodore Tso
  2006-06-19 17:17   ` Jan Engelhardt
  2006-06-19 19:09   ` Christoph Hellwig
@ 2006-06-20  9:43   ` Steven Whitehouse
  2006-06-20 11:45     ` Arnd Bergmann
  2006-06-20 12:29     ` Theodore Tso
  2 siblings, 2 replies; 46+ messages in thread
From: Steven Whitehouse @ 2006-06-20  9:43 UTC (permalink / raw)
  To: Theodore Tso; +Cc: linux-kernel

Hi,

On Mon, 2006-06-19 at 11:20 -0400, Theodore Tso wrote:
> plain text document attachment (inode-slim-1)
> 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.
> 
> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
> 
> Index: linux-2.6.17/include/linux/fs.h
> ===================================================================
> --- linux-2.6.17.orig/include/linux/fs.h	2006-06-18 18:58:51.000000000 -0400
> +++ linux-2.6.17/include/linux/fs.h	2006-06-18 18:58:55.000000000 -0400
> @@ -534,9 +534,7 @@
>  
>  	atomic_t		i_writecount;
>  	void			*i_security;
> -	union {
> -		void		*generic_ip;
> -	} u;
> +	void			*i_private; /* fs or device private pointer */
>  #ifdef __NEED_I_SIZE_ORDERED
>  	seqcount_t		i_size_seqcount;
>  #endif

As a further suggestion, I wonder do we really need i_private at all?
Since we have sb->s_op->alloc_inode and inode->i_sb->s_op->destroy_inode
if all filesystems did something along the following lines:

struct myfs_inode {
	struct inode i_inode;
	...
};

#define MYFS_I(inode) container_of((inode), struct myfs_inode, i_inode)

then it would seem that i_private is redundant. If there is a file
system which does genuinely need a pointer here (if indeed such a
filesystem does exist, I haven't actually checked that) then a pointer
can just be added as the one single other member of (in my example)
struct myfs_inode.

Steve.



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 1/8] inode_diet: Replace inode.u.generic_ip with inode.i_private
  2006-06-20  9:43   ` Steven Whitehouse
@ 2006-06-20 11:45     ` Arnd Bergmann
  2006-06-20 12:34       ` Steven Whitehouse
  2006-06-20 12:29     ` Theodore Tso
  1 sibling, 1 reply; 46+ messages in thread
From: Arnd Bergmann @ 2006-06-20 11:45 UTC (permalink / raw)
  To: Steven Whitehouse; +Cc: Theodore Tso, linux-kernel

On Tuesday 20 June 2006 11:43, Steven Whitehouse wrote:
> As a further suggestion, I wonder do we really need i_private at all?
> Since we have sb->s_op->alloc_inode and inode->i_sb->s_op->destroy_inode
> if all filesystems did something along the following lines:
> 
> struct myfs_inode {
>         struct inode i_inode;
>         ...
> };
> 
> #define MYFS_I(inode) container_of((inode), struct myfs_inode, i_inode)
> 
> then it would seem that i_private is redundant. If there is a file
> system which does genuinely need a pointer here (if indeed such a
> filesystem does exist, I haven't actually checked that) then a pointer
> can just be added as the one single other member of (in my example)
> struct myfs_inode.
> 
That would mean that all file systems need to implement ->alloc_inode,
which in turn need slab caches that eat consume memory even when
the file system is not mounted.

Something as simple as nfsctl or devpts should not need that.

	Arnd <><

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 1/8] inode_diet: Replace inode.u.generic_ip with inode.i_private
  2006-06-20  9:43   ` Steven Whitehouse
  2006-06-20 11:45     ` Arnd Bergmann
@ 2006-06-20 12:29     ` Theodore Tso
  1 sibling, 0 replies; 46+ messages in thread
From: Theodore Tso @ 2006-06-20 12:29 UTC (permalink / raw)
  To: Steven Whitehouse; +Cc: linux-kernel

On Tue, Jun 20, 2006 at 10:43:16AM +0100, Steven Whitehouse wrote:
> As a further suggestion, I wonder do we really need i_private at all?
> Since we have sb->s_op->alloc_inode and inode->i_sb->s_op->destroy_inode
> if all filesystems did something along the following lines:
> 
> struct myfs_inode {
> 	struct inode i_inode;
> 	...
> };
> 
> #define MYFS_I(inode) container_of((inode), struct myfs_inode, i_inode)

That would work for filesystems but we would also need some solution
for device inodes.  (And at that point, yes, we could move it into
device-specific union, but as I've already noted, that doesn't buy us
anything currently.)

It's worth thinking about, but for that amount of effort it might be
have better ROI to work on moving the address space out of the inode
given that many/most inodes in memory are caching stat information,
not pages.

						- Ted

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 1/8] inode_diet: Replace inode.u.generic_ip with inode.i_private
  2006-06-20 11:45     ` Arnd Bergmann
@ 2006-06-20 12:34       ` Steven Whitehouse
  2006-06-20 13:53         ` Arnd Bergmann
  0 siblings, 1 reply; 46+ messages in thread
From: Steven Whitehouse @ 2006-06-20 12:34 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Theodore Tso, linux-kernel

Hi,

On Tue, 2006-06-20 at 13:45 +0200, Arnd Bergmann wrote:
> On Tuesday 20 June 2006 11:43, Steven Whitehouse wrote:
> > As a further suggestion, I wonder do we really need i_private at all?
> > Since we have sb->s_op->alloc_inode and inode->i_sb->s_op->destroy_inode
> > if all filesystems did something along the following lines:
> > 
> > struct myfs_inode {
> >         struct inode i_inode;
> >         ...
> > };
> > 
> > #define MYFS_I(inode) container_of((inode), struct myfs_inode, i_inode)
> > 
> > then it would seem that i_private is redundant. If there is a file
> > system which does genuinely need a pointer here (if indeed such a
> > filesystem does exist, I haven't actually checked that) then a pointer
> > can just be added as the one single other member of (in my example)
> > struct myfs_inode.
> > 
> That would mean that all file systems need to implement ->alloc_inode,
> which in turn need slab caches that eat consume memory even when
> the file system is not mounted.
> 
Yes, although I'm not sure that it would be as significant as the memory
saved by removing the pointer bearing in mind the relative numbers of
the structures that you'd expect to see in a "normal" working system. We
could also try and reduce this by creating a special inode cache which
would be shared by all filesystems which did still need just struct
inode + private pointer for example.

What you do gain though is (on umount of a filesystem) a much greater
likelihood of being able to reclaim the memory which was being used by
the inodes of that particular filesystem (particularly so if you only
have a single mounted filesystem of a particular type). So hopefully
having a separate slab cache per fstype would help reduce memory
fragmentation, and more than compensate for the difference.

In fact a number of filesystems already have slab caches for their own
private part of the inode anyway... I count 10 of those on my current
development box.

> Something as simple as nfsctl or devpts should not need that.
> 
> 	Arnd <><

Steve.



^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 1/8] inode_diet: Replace inode.u.generic_ip with inode.i_private
  2006-06-20 12:34       ` Steven Whitehouse
@ 2006-06-20 13:53         ` Arnd Bergmann
  2006-06-20 15:01           ` Brian F. G. Bidulock
  0 siblings, 1 reply; 46+ messages in thread
From: Arnd Bergmann @ 2006-06-20 13:53 UTC (permalink / raw)
  To: Steven Whitehouse; +Cc: Theodore Tso, linux-kernel

On Tuesday 20 June 2006 14:34, Steven Whitehouse wrote:
> 
> Yes, although I'm not sure that it would be as significant as the memory
> saved by removing the pointer bearing in mind the relative numbers of
> the structures that you'd expect to see in a "normal" working system. We
> could also try and reduce this by creating a special inode cache which
> would be shared by all filesystems which did still need just struct
> inode + private pointer for example.

To take this further, you could indeed split struct inode into a smaller
struct that has all the important parts and a derived struct that has
i_private as well as other members that are used only by a minority
of file systems.

Alternatively, it might be possible to stuff i_private into the same
union as i_pipe, i_cdev and i_bdev. The rationale here being that
a file system implementing different file types already is complex
enough that you would normally want your own alloc_inode for a
derived struct. The simple file systems OTOH normally only support
regular files, and sometimes directories.

	Arnd <><

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 1/8] inode_diet: Replace inode.u.generic_ip with inode.i_private
  2006-06-20 13:53         ` Arnd Bergmann
@ 2006-06-20 15:01           ` Brian F. G. Bidulock
  2006-06-20 15:04             ` Brian F. G. Bidulock
  0 siblings, 1 reply; 46+ messages in thread
From: Brian F. G. Bidulock @ 2006-06-20 15:01 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Steven Whitehouse, Theodore Tso, linux-kernel

Arnd,

On Tue, 20 Jun 2006, Arnd Bergmann wrote:
> 
> Alternatively, it might be possible to stuff i_private into the same
> union as i_pipe, i_cdev and i_bdev. The rationale here being that
> a file system implementing different file types already is complex
> enough that you would normally want your own alloc_inode for a
> derived struct. The simple file systems OTOH normally only support
> regular files, and sometimes directories.

Placing i_private and i_pipe in the same union will break FIFOs.

Also, i_pipe should not be combined with i_cdev and i_bdev.


^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 1/8] inode_diet: Replace inode.u.generic_ip with inode.i_private
  2006-06-20 15:01           ` Brian F. G. Bidulock
@ 2006-06-20 15:04             ` Brian F. G. Bidulock
  0 siblings, 0 replies; 46+ messages in thread
From: Brian F. G. Bidulock @ 2006-06-20 15:04 UTC (permalink / raw)
  To: Arnd Bergmann, Steven Whitehouse, Theodore Tso, linux-kernel

Arnd,

On Tue, 20 Jun 2006, Brian F. G. Bidulock wrote:
> 
> Placing i_private and i_pipe in the same union will break FIFOs.
> 
> Also, i_pipe should not be combined with i_cdev and i_bdev.
> 

Also, both character and block devices need separate use of i_private.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 2/8] inode-diet: Move i_pipe into a union
  2006-06-19 19:06     ` Theodore Tso
@ 2006-06-20 15:23       ` Brian F. G. Bidulock
  2006-06-21  1:45         ` Theodore Tso
  0 siblings, 1 reply; 46+ messages in thread
From: Brian F. G. Bidulock @ 2006-06-20 15:23 UTC (permalink / raw)
  To: Theodore Tso, Jan Engelhardt, linux-kernel

Theodore,

On Mon, 19 Jun 2006, Theodore Tso wrote:
> 
> As was mentioned in earlier comment, this will be problematic for the
> out-of-tree System V Streams code, which hijacks i_pipe as another
> place to store 4 bytes of random data needed for the Streams code (I
> believe they needed a pointer to the stream head -- the v_str pointer
> in a legacy Unix system's inode).  But, that is an out-of-tree kernel
> module, and it's a clear abuse of the i_pipe element in any case.

It's used for implementing STREAMS-based FIFOs.  Which is a proper use
of i_pipe (which is for FIFOs).  Pipes (both mainline and STREAMS-based
pipes) can use i_private instead of i_pipe.

For the same reason why i_pipe cannot be combined with i_private.


^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 2/8] inode-diet: Move i_pipe into a union
  2006-06-20 15:23       ` Brian F. G. Bidulock
@ 2006-06-21  1:45         ` Theodore Tso
  2006-06-22  9:03           ` Brian F. G. Bidulock
  0 siblings, 1 reply; 46+ messages in thread
From: Theodore Tso @ 2006-06-21  1:45 UTC (permalink / raw)
  To: Jan Engelhardt, linux-kernel

On Tue, Jun 20, 2006 at 09:23:51AM -0600, Brian F. G. Bidulock wrote:
> 
> It's used for implementing STREAMS-based FIFOs.  Which is a proper use
> of i_pipe (which is for FIFOs).  Pipes (both mainline and STREAMS-based
> pipes) can use i_private instead of i_pipe.

It's is an abuse of i_pipe.  You are using something which is supposed
to hold a struct pipe_info, and storing the head of the STREAM stack,
which is some other type.  

In any case, when you state authoratively what "can" and "can not" be
combined, please specify when your justification is for a particular
out of tree modules.

						- Ted

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 5/8] inode-diet: Eliminate i_blksize and use a per-superblock default
  2006-06-19 17:20       ` Theodore Tso
  2006-06-19 18:55         ` Christoph Hellwig
@ 2006-06-21 19:41         ` Nate Diller
  1 sibling, 0 replies; 46+ messages in thread
From: Nate Diller @ 2006-06-21 19:41 UTC (permalink / raw)
  To: Theodore Tso, Christoph Hellwig, linux-kernel

On 6/19/06, Theodore Tso <tytso@mit.edu> wrote:
> On Mon, Jun 19, 2006 at 09:16:51AM -0700, Joel Becker wrote:
> > On Mon, Jun 19, 2006 at 04:58:21PM +0100, Christoph Hellwig wrote:
> > > Blease don't add a field to the superblock for the optimal I/O size.
> > > Any filesystem that wants to override it can do so directly in ->getattr.
> >
> >       I don't disagree with you, but the idea of everyone implementing
> > ->getattr where they just let it work before scares me.  It's a ton of
> > cut-n-paste error waiting to happen.  Especially if we make something
> > stale.
> >       Perhaps add generic_fillattr_blksize()?
>
> Well, as far as I know the only filesystems today that would need to
> do something different are xfs, ocfs2, and reiserfs, and IMHO only the
> first two have any kind of justification for doing it.  Part of the
> problem is what st_blksize actually means was never well-defined; it
> was never in POSIX, and in SuSv3 all that is stated is, "A file
> system-specific preferred I/O block size for this object."  This is
> why Reiserfs got away with specifying 128 megs (I assume it helped on
> some benchmark), and why being ill-defined, using such a large value
> might cause some applications (like /bin/cp) to core dump.
>
> Given that most filesystems use the generic page cache read/write
> functions, using PAGE_CACHE_SIZE as the default seems to make a huge
> amount of sense.  I really wonder how useful setting st_blksize really
> is, actually, at least in the real-world, as opposed to just for
> benchmarks.

I assume "128 megs" is a typo, it's 128k, of course.  And certainly it
would have helped speed things up, not just benchmarks, because for
modern disks, doing 128k vs 4k takes like 25% more time.  Wu's
adaptive readahead patches might make this outdated, though, since
they now support "read 10 pages, seek, read 10 pages, seek, etc" type
workloads.

NATE

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [RFC] [PATCH 2/8] inode-diet: Move i_pipe into a union
  2006-06-21  1:45         ` Theodore Tso
@ 2006-06-22  9:03           ` Brian F. G. Bidulock
  0 siblings, 0 replies; 46+ messages in thread
From: Brian F. G. Bidulock @ 2006-06-22  9:03 UTC (permalink / raw)
  To: Theodore Tso, Jan Engelhardt, linux-kernel

Theodore,

On Tue, 20 Jun 2006, Theodore Tso wrote:
> 
> In any case, when you state authoratively what "can" and "can not" be
> combined, please specify when your justification is for a particular
> out of tree modules.

In that case, be my guest: combine i_pipe with i_private: see if what
you break is worth the gain.


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [RFC] [PATCH 2/8] inode-diet: Move i_pipe into a union
  2006-06-21 12:51 [RFC] [PATCH 0/8] Inode diet v2 Theodore Tso
@ 2006-06-21 12:51 ` Theodore Tso
  0 siblings, 0 replies; 46+ messages in thread
From: Theodore Tso @ 2006-06-21 12:51 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: inode-slim-2 --]
[-- Type: text/plain, Size: 712 bytes --]

Move the i_pipe pointer into a union that will be shared with i_bdev
and i_cdev.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>


Index: linux-2.6.17/include/linux/fs.h
===================================================================
--- linux-2.6.17.orig/include/linux/fs.h	2006-06-18 19:37:39.000000000 -0400
+++ linux-2.6.17/include/linux/fs.h	2006-06-18 19:39:52.000000000 -0400
@@ -508,9 +508,10 @@
 #ifdef CONFIG_QUOTA
 	struct dquot		*i_dquot[MAXQUOTAS];
 #endif
-	/* These three should probably be a union */
 	struct list_head	i_devices;
-	struct pipe_inode_info	*i_pipe;
+	union {
+		struct pipe_inode_info	*i_pipe;
+	};
 	struct block_device	*i_bdev;
 	struct cdev		*i_cdev;
 	int			i_cindex;

--

^ permalink raw reply	[flat|nested] 46+ messages in thread

end of thread, other threads:[~2006-06-22  9:03 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-19 15:20 [RFC] [PATCH 0/8] Inode slimming Theodore Tso
2006-06-19 15:20 ` [RFC] [PATCH 1/8] inode_diet: Replace inode.u.generic_ip with inode.i_private Theodore Tso
2006-06-19 17:17   ` Jan Engelhardt
2006-06-19 19:09   ` Christoph Hellwig
2006-06-19 19:37     ` Theodore Tso
2006-06-20  9:43   ` Steven Whitehouse
2006-06-20 11:45     ` Arnd Bergmann
2006-06-20 12:34       ` Steven Whitehouse
2006-06-20 13:53         ` Arnd Bergmann
2006-06-20 15:01           ` Brian F. G. Bidulock
2006-06-20 15:04             ` Brian F. G. Bidulock
2006-06-20 12:29     ` Theodore Tso
2006-06-19 15:20 ` [RFC] [PATCH 2/8] inode-diet: Move i_pipe into a union Theodore Tso
2006-06-19 17:19   ` Jan Engelhardt
2006-06-19 19:06     ` Theodore Tso
2006-06-20 15:23       ` Brian F. G. Bidulock
2006-06-21  1:45         ` Theodore Tso
2006-06-22  9:03           ` Brian F. G. Bidulock
2006-06-19 15:20 ` [RFC] [PATCH 3/8] inode-diet: Move i_bdev " Theodore Tso
2006-06-19 15:20 ` [RFC] [PATCH 4/8] inode-diet: Move i_cdev " Theodore Tso
2006-06-19 17:20   ` Jan Engelhardt
2006-06-19 15:20 ` [RFC] [PATCH 5/8] inode-diet: Eliminate i_blksize and use a per-superblock default Theodore Tso
2006-06-19 15:49   ` Avi Kivity
2006-06-19 16:55     ` Theodore Tso
2006-06-19 15:58   ` Christoph Hellwig
2006-06-19 16:16     ` Joel Becker
2006-06-19 17:20       ` Theodore Tso
2006-06-19 18:55         ` Christoph Hellwig
2006-06-19 22:13           ` Mark Fasheh
2006-06-21 19:41         ` Nate Diller
2006-06-19 17:03     ` Theodore Tso
2006-06-19 18:56       ` Christoph Hellwig
2006-06-19 16:01   ` Joel Becker
2006-06-19 17:06     ` Theodore Tso
2006-06-19 21:45       ` Joel Becker
2006-06-19 22:14       ` Mark Fasheh
2006-06-19 15:20 ` [RFC] [PATCH 6/8] inode-diet: Move i_cindex from struct inode to struct file Theodore Tso
2006-06-19 19:33   ` Al Viro
2006-06-19 19:37     ` Al Viro
2006-06-19 20:58       ` Theodore Tso
2006-06-19 21:51         ` Stefan Richter
2006-06-19 15:20 ` [RFC] [PATCH 7/8] inode-diet: Use a union for i_blocks and i_size, i_rdev and i_devices Theodore Tso
2006-06-19 15:20 ` [RFC] [PATCH 8/8] inode-diet: Fix size of i_blkbits, i_version, and i_dnotify_mask Theodore Tso
2006-06-19 16:54 ` [RFC] [PATCH 0/8] Inode slimming Christoph Lameter
2006-06-19 19:09   ` Theodore Tso
2006-06-21 12:51 [RFC] [PATCH 0/8] Inode diet v2 Theodore Tso
2006-06-21 12:51 ` [RFC] [PATCH 2/8] inode-diet: Move i_pipe into a union Theodore Tso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).