mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Theodore Tso <tytso@thunk.org>
To: linux-kernel@vger.kernel.org
Subject: [RFC] [PATCH 7/8] inode-diet: Use a union for i_blocks and i_size, i_rdev and i_devices
Date: Wed, 21 Jun 2006 08:51:53 -0400	[thread overview]
Message-ID: <20060621125217.981388000@candygram.thunk.org> (raw)
In-Reply-To: <20060621125146.508341000@candygram.thunk.org>

[-- Attachment #1: inode-slim-7 --]
[-- Type: text/plain, Size: 1887 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-20 23:37:20.000000000 -0400
+++ linux-2.6.17/include/linux/fs.h	2006-06-20 23:37:29.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;
Index: linux-2.6.17/fs/stat.c
===================================================================
--- linux-2.6.17.orig/fs/stat.c	2006-06-20 22:04:21.000000000 -0400
+++ linux-2.6.17/fs/stat.c	2006-06-20 23:38:00.000000000 -0400
@@ -33,7 +33,7 @@
 	stat->mtime = inode->i_mtime;
 	stat->ctime = inode->i_ctime;
 	stat->size = i_size_read(inode);
-	stat->blocks = inode->i_blocks;
+	stat->blocks = S_ISREG(inode->i_mode) ? inode->i_blocks : 0;
 	stat->blksize = PAGE_CACHE_SIZE;
 }
 

--

  parent reply	other threads:[~2006-06-21 12:54 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-21 12:51 [RFC] [PATCH 0/8] Inode diet v2 Theodore Tso
2006-06-21 12:51 ` [RFC] [PATCH 1/8] inode_diet: Replace inode.u.generic_ip with inode.i_private Theodore Tso
2006-06-21 13:23   ` Jan Engelhardt
2006-06-21 14:44   ` Brian F. G. Bidulock
2006-06-21 15:37     ` Theodore Tso
2006-06-21 12:51 ` [RFC] [PATCH 2/8] inode-diet: Move i_pipe into a union Theodore Tso
2006-06-21 12:51 ` [RFC] [PATCH 3/8] inode-diet: Move i_bdev " Theodore Tso
2006-06-21 12:51 ` [RFC] [PATCH 4/8] inode-diet: Move i_cdev " Theodore Tso
2006-06-21 12:51 ` [RFC] [PATCH 5/8] inode-diet: Eliminate i_blksize and use a per-superblock default Theodore Tso
2006-06-21 12:51 ` [RFC] [PATCH 6/8] inode-diet: Move i_cindex from struct inode to struct file Theodore Tso
2006-06-21 12:51 ` Theodore Tso [this message]
2006-06-21 12:51 ` [RFC] [PATCH 8/8] inode-diet: Fix size of i_blkbits, i_version, and i_dnotify_mask Theodore Tso
     [not found]   ` <200606212335.00176.arnd@arndb.de>
2006-06-22  3:11     ` Theodore Tso
2006-06-21 14:42 ` [RFC] [PATCH 0/8] Inode diet v2 Brian F. G. Bidulock
2006-06-21 15:31   ` Nick Piggin
2006-06-21 16:06   ` Arjan van de Ven
2006-06-21 16:12     ` Brian F. G. Bidulock
2006-06-21 16:48   ` Theodore Tso
  -- strict thread matches above, loose matches on Subject: below --
2006-06-19 15:20 [RFC] [PATCH 0/8] Inode slimming Theodore Tso
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060621125217.981388000@candygram.thunk.org \
    --to=tytso@thunk.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®