xfs
[Top] [All Lists]

[PATCH] Re: Reduce XFS footprint (was Re: TAKE - remove a function xfs a

To: Nathan Scott <nathans@xxxxxxx>
Subject: [PATCH] Re: Reduce XFS footprint (was Re: TAKE - remove a function xfs added to filemap.c
From: Andi Kleen <ak@xxxxxxx>
Date: Tue, 29 Jan 2002 19:40:01 +0100
Cc: linux-xfs@xxxxxxxxxxx
In-reply-to: <200201291751.g0THp897004750@scare.vieo.com>
References: <200201291751.g0THp897004750@scare.vieo.com>
Sender: owner-linux-xfs@xxxxxxxxxxx
User-agent: Mutt/1.3.22.1i
On Tue, Jan 29, 2002 at 12:53:54PM +1100, Nathan Scott wrote:
> On Sat, Jan 26, 2002 at 01:59:15PM -0600, Stephen Lord wrote:
> > Ralf G. R. Bergs wrote:
> > 
> > >>You could try editing xfs_types.h and  changing
> > ...
> > It does compile and run, and you save about 45K in code size by doing it,
> > so not too much. You can also edit xfs_macros.h and define WANT_SPACE_C
> > to 1 (replace the existing definition). This turns a lot of inline 
> > macros into
> > function calls - it will be slower, but it is another 10K less code - 
> > again, not
> > very much.
> > 
> 
> Another thing we could try is to make support for v1 dirs
> compile-time conditional (since noone/very few people will
> be using this), this might save a bit more space.  I think
> the code is all accessed via function pointers already, so
> the points of abstraction should be clearly defined.

This patch does it. It's very simple and clean.
Saves another 18K on a xfs with BIG_FILESYSTEMS and BIG_FILES disabled. 

For completeness I also added BIG_FILES and BIG_FILESYSTEMS as
visible CONFIG options. BIG_FILES does not seem to be that useful
(except perhaps for some embedded apps or people with bad compiler
problems with long long), but having BIG_FILESYSTEMS is probably a good idea
because linux 2.4 doesn't support block devices >2TB anyways and
there is also the 64bit inode number support missing for it. I don't 
see much reason currently in 2.4 to enable it. 

-Andi


--- linux/fs/xfs/xfs_types.h-V1 Wed Aug  8 16:08:34 2001
+++ linux/fs/xfs/xfs_types.h    Tue Jan 29 18:57:17 2002
@@ -43,8 +43,17 @@
  * defs files for the normal case.
  */
 
+#ifdef CONFIG_XFS_BIG_FILES 
 #define        XFS_BIG_FILES           1
+#else
+#define XFS_BIG_FILES          0
+#endif
+
+#ifdef CONFIG_XFS_BIG_FILESYSTEMS
 #define        XFS_BIG_FILESYSTEMS     1
+#else
+#define XFS_BIG_FILESYSTEMS    0
+#endif
 
 typedef __uint32_t     xfs_agblock_t;  /* blockno in alloc. group */
 typedef        __uint32_t      xfs_extlen_t;   /* extent length in blocks */
--- linux/fs/xfs/xfsidbg.c-V1   Sun Jan 27 15:42:22 2002
+++ linux/fs/xfs/xfsidbg.c      Tue Jan 29 19:23:47 2002
@@ -2475,7 +2475,7 @@
 #else
                kdb_printf(" blk %d bp 0x%p blkno 0x%Lx",
 #endif
-                       i, p->blk[i].bp, p->blk[i].blkno);
+                       i, p->blk[i].bp, (unsigned long long)p->blk[i].blkno);
                kdb_printf(" index %d hashval 0x%x ",
                        p->blk[i].index, (uint_t)p->blk[i].hashval);
                switch(p->blk[i].magic) {
@@ -2579,7 +2579,7 @@
        if (bno == NULLFSBLOCK)
                sprintf(rval, "NULLFSBLOCK");
        else if (ISNULLSTARTBLOCK(bno))
-               sprintf(rval, "NULLSTARTBLOCK(%Ld)", STARTBLOCKVAL(bno));
+               sprintf(rval, "NULLSTARTBLOCK(%Ld)", (unsigned long 
long)STARTBLOCKVAL(bno));
        else if (mp)
                sprintf(rval, "%Ld[%x:%x]", (xfs_dfsbno_t)bno,
                        XFS_FSB_TO_AGNO(mp, bno), XFS_FSB_TO_AGBNO(mp, bno));
@@ -3545,7 +3545,7 @@
 #if XFS_BIG_FILES
        kdb_printf(" bp 0x%p blkno 0x%x ", eblk->bp, eblk->blkno);
 #else
-       kdb_printf(" bp 0x%x blkno 0x%x ", eblk->bp, eblk->blkno);
+       kdb_printf(" bp 0x%p blkno 0x%x ", eblk->bp, eblk->blkno);
 #endif
        kdb_printf("index %d hashval 0x%x\n", eblk->index, 
(uint_t)eblk->hashval);
 }
--- linux/fs/xfs/xfs_mount.c-V1 Sun Jan 27 15:42:22 2002
+++ linux/fs/xfs/xfs_mount.c    Tue Jan 29 18:46:06 2002
@@ -846,10 +846,18 @@
        /*
         * Select the right directory manager.
         */
-       mp->m_dirops =
-               XFS_SB_VERSION_HASDIRV2(&mp->m_sb) ?
-                       xfsv2_dirops :
-                       xfsv1_dirops;
+
+       if (!XFS_SB_VERSION_HASDIRV2(&mp->m_sb)) { 
+#ifdef CONFIG_XFS_V1_DIR
+               mp->m_dirops = xfsv1_dirops; 
+#else
+               cmn_err(CE_WARN, "XFS: v1 directories not compiled in");
+               goto error1;            
+#endif
+       } else { 
+               mp->m_dirops = xfsv2_dirops; 
+       } 
+
 
        /*
         * Initialize directory manager's entries.
--- linux/fs/xfs/Makefile-V1    Tue Jan 29 18:47:03 2002
+++ linux/fs/xfs/Makefile       Tue Jan 29 19:33:41 2002
@@ -73,6 +73,10 @@
   obj-y                                += xfs_grio.o
 endif
 
+ifneq ($(CONFIG_XFS_V1_DIR),)
+  obj-y                                += xfs_dir.o xfs_dir_leaf.o
+endif
+
 ifeq ($(CONFIG_HAVE_XFS_DMAPI),)
   obj-y                                += xfsdmapistubs.o
 else
@@ -100,7 +104,6 @@
                                   xfs_btree.o \
                                   xfs_buf_item.o \
                                   xfs_da_btree.o \
-                                  xfs_dir.o \
                                   xfs_dir2.o \
                                   xfs_dir2_block.o \
                                   xfs_dir2_data.o \
@@ -108,7 +111,6 @@
                                   xfs_dir2_node.o \
                                   xfs_dir2_sf.o \
                                   xfs_dir2_trace.o \
-                                  xfs_dir_leaf.o \
                                   xfs_error.o \
                                   xfs_extfree_item.o \
                                   xfs_fsops.o \
--- linux/fs/Config.in-V1       Sun Jan 27 15:42:16 2002
+++ linux/fs/Config.in  Tue Jan 29 18:59:47 2002
@@ -90,6 +90,9 @@
 tristate 'SGI XFS filesystem support' CONFIG_XFS_FS
 dep_mbool    '  Enable XFS Realtime support' CONFIG_XFS_RT $CONFIG_XFS_FS
 dep_mbool    '  Enable XFS Quota' CONFIG_XFS_QUOTA $CONFIG_XFS_FS
+dep_mbool    '  Enable XFSv1 directories' CONFIG_XFS_V1_DIR
+dep_mbool    '  Enable XFS filesystems greater than 2TB' 
CONFIG_XFS_BIG_FILESYSTEMS
+dep_mbool    '  Enable XFS files greater than 2GB' CONFIG_XFS_BIG_FILES
 if [ "$CONFIG_XFS_FS" != "n" ]; then
     define_bool CONFIG_HAVE_ATTRCTL y
     dep_tristate '  Enable XFS DMAPI' CONFIG_XFS_DMAPI $CONFIG_XFS_FS


<Prev in Thread] Current Thread [Next in Thread>