mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: [PATCH] shrink inode when quota is disabled
@ 2004-04-03 17:10 Ray Lee
  0 siblings, 0 replies; 2+ messages in thread
From: Ray Lee @ 2004-04-03 17:10 UTC (permalink / raw)
  To: mpm; +Cc: Linux Kernel

Matt Mackall wrote:

>          struct address_space i_data; 
> +#ifdef CONFIG_QUOTA 
>          struct dquot *i_dquot[MAXQUOTAS]; 
> +#endif 
>          /* These three should probably be a union */ 
>          struct list_head i_devices; 
 
Forgive me if I'm asking a stupid question, but did this actually make a
difference in the inode size? On gcc 2.95 and 3.3, if MAXQUOTAS is zero,
gcc will silently elide that struct member. (Though it will leave a
residue of sorts behind -- it participates as far as structure field
alignment is concerned, but that isn't an issue here.) I believe
zero-length arrays are actually an ANSI C thing, but I didn't see it in
a quick perusal of my K&R.

Or, hmm... <does grep> Oh, MAXQUOTAS is set to 2 unconditionally in
include/linux/quota.h. How about putting the #ifdef's in there, and
setting it to zero if CONFIG_QUOTA is not set? That'd localize the
preprocessor noise.

Like this (compiled with CONFIG_QUOTA unset, but not booted):

Shrink struct inode by two pointers if CONFIG_QUOTA is unset.

diff -NurX ../dontdiff linus-2.6/include/linux/quota.h linus-2.6-inode-shrinkage/include/linux/quota.h
--- linus-2.6/include/linux/quota.h	2004-04-03 08:46:35.000000000 -0800
+++ linus-2.6-inode-shrinkage/include/linux/quota.h	2004-04-03 08:45:19.000000000 -0800
@@ -57,7 +57,11 @@
 #define kb2qb(x) ((x) >> (QUOTABLOCK_BITS-10))
 #define toqb(x) (((x) + QUOTABLOCK_SIZE - 1) >> QUOTABLOCK_BITS)
 
+#ifdef CONFIG_QUOTA
 #define MAXQUOTAS 2
+#else
+#define MAXQUOTAS 0
+#endif
 
 #define USRQUOTA  0		/* element used for user quotas */
 #define GRPQUOTA  1		/* element used for group quotas */


--
Ray Lee  ~  http://madrabbit.org


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

* [PATCH] shrink inode when quota is disabled
@ 2004-04-03  4:24 Matt Mackall
  0 siblings, 0 replies; 2+ messages in thread
From: Matt Mackall @ 2004-04-03  4:24 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton


drop quota array in inode struct if no quota support


 tiny-mpm/fs/inode.c         |    2 ++
 tiny-mpm/include/linux/fs.h |    2 ++
 2 files changed, 4 insertions(+)

Index: tiny/include/linux/fs.h
===================================================================
--- tiny.orig/include/linux/fs.h	2004-04-02 20:24:36.000000000 -0600
+++ tiny/include/linux/fs.h	2004-04-02 20:28:07.000000000 -0600
@@ -403,7 +403,9 @@
 	struct file_lock	*i_flock;
 	struct address_space	*i_mapping;
 	struct address_space	i_data;
+#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;
Index: tiny/fs/inode.c
===================================================================
--- tiny.orig/fs/inode.c	2004-04-02 20:24:35.000000000 -0600
+++ tiny/fs/inode.c	2004-04-02 20:28:07.000000000 -0600
@@ -126,7 +126,9 @@
 		inode->i_blocks = 0;
 		inode->i_bytes = 0;
 		inode->i_generation = 0;
+#ifdef CONFIG_QUOTA
 		memset(&inode->i_dquot, 0, sizeof(inode->i_dquot));
+#endif
 		inode->i_pipe = NULL;
 		inode->i_bdev = NULL;
 		inode->i_cdev = NULL;


-- 
Matt Mackall : http://www.selenic.com : Linux development and consulting

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

end of thread, other threads:[~2004-04-03 17:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-03 17:10 [PATCH] shrink inode when quota is disabled Ray Lee
  -- strict thread matches above, loose matches on Subject: below --
2004-04-03  4:24 Matt Mackall

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®