xfs
[Top] [All Lists]

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

To: Eric Sandeen <sandeen@xxxxxxx>
Subject: Re: [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 21:17:58 +0100
Cc: Andi Kleen <ak@xxxxxxx>, Nathan Scott <nathans@xxxxxxx>, linux-xfs@xxxxxxxxxxx
In-reply-to: <1012334201.5905.25.camel@xxxxxxxxxxxxxxxxxxxxxx>
References: <200201291751.g0THp897004750@xxxxxxxxxxxxxx> <20020129194001.A16401@xxxxxxxxxxxxx> <20020129202509.A31370@xxxxxxxxxxxxx> <1012334201.5905.25.camel@xxxxxxxxxxxxxxxxxxxxxx>
Sender: owner-linux-xfs@xxxxxxxxxxx
User-agent: Mutt/1.3.22.1i
On Tue, Jan 29, 2002 at 01:56:41PM -0600, Eric Sandeen wrote:
> Yep, I just saw that.   And FWIW, the stated limit for the filesystem
> size w/o XFS_BIG_FILESYSTEMS isn't quite right*.  I think these are
> correct (these are internal XFS limitations):
> 
> File size:
> o Without XFS_BIG_FILES, the max filesize is 1<<40, or 2TiB.

I misread blockno in xfs_types.h as byteno. It should be 2^31 * blocksize,
which would be 2^43 with 4K blocks or more with bigger block size.
I don't see any other limit.

How do you get to 2^40 ? 

Also Linux/32bit is VM limited to 2^31 * PAGE_SIZE, so assuming PAGE_SIZE==
blocksize XFS_BIG_FILES should not be needed at all on 32bit linux.

On 64bit it probably makes sense to hardcode them both to 1. 

Where I am wrong ? 

> o With XFS_BIG_FILES, the max filesize is 1<<63-1.
>   However, Linux can only handle 1<<(32+PAGE_SHIFT), or

2^(31+PAGE_SHIFT) 

>   (2GiB * PAGE_SIZE), or 16TiB for machines w/ 4k pages.

I come to 8TB, which would be the same limit as I get to for !XFS_BIG_FILES
above for 4K fs. 
The only special case where XFS_BIG_FILES would be needed again would be 
PAGE_SIZE<BLOCK_SIZE, but so far this isn't implemented. 

> *Not that it matters, since Linux can't do > 2T anyway...

2.5 should handle it soon. 

In summary I think: 
- XFS_BIG_FILES and XFS_BIG_FILESYSTEMS should be both be set to 0 
on 32bit, but can be set to 1 on 64bit systems because it shouldn't make
much difference there anyways except some more cache footprint. 
- In 2.5 as soon as sector_t becomes 64bit XFS_BIG_FILESYSTEMS should
be set to one unconditional. 

This revised patch implements this. 

-Andi


--- linux/fs/xfs/xfs_types.h-V1 Wed Aug  8 16:08:34 2001
+++ linux/fs/xfs/xfs_types.h    Tue Jan 29 21:15:22 2002
@@ -43,8 +43,17 @@
  * defs files for the normal case.
  */
 
+#if BITS_PER_LONG==64
 #define        XFS_BIG_FILES           1
+#else
+#define XFS_BIG_FILES          0
+#endif
+
+#if BITS_PER_LONG==64 || defined(BLK_64BIT_SECTOR) 
 #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 21:13:02 2002
@@ -89,7 +89,8 @@
 
 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 XFS Quota' CONFIG_XFS_QUOTA $CONFIG_XFS_FS 
+dep_mbool    '  Enable XFSv1 directories' CONFIG_XFS_V1_DIR $CONFIG_XFS_FS
 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>