diff -u defrag-0.73pjm1/debian/changelog defrag-0.73pjm1/debian/changelog --- defrag-0.73pjm1/debian/changelog +++ defrag-0.73pjm1/debian/changelog @@ -1,3 +1,19 @@ +defrag (0.73pjm1-8ubuntu0) unstable; urgency=low + + * fix-ctime-warnings.dpatch: Fixes some warnings causing build failure + and possibly incorrect behavior if time_t is not 32 bits + * Disabled ext3-notwork.dpatch + * handle-reserved-inodes.dpatch: Fixes a bug where reserved inodes + ( like the ext3 journal inode ) would have their indirect blocks + optimized but not saved, causing filesystem corruption + * allow-ext3-journal-move.dpatch: Allows the data blocks of the ext3 + journal inode to be moved instead of treating them as fixed because + it is a reserved inode + * boost-pool-size.dpatch: Increases the default buffer size from 2 MB + to 32 MB for better performance on modern machines + + -- Phillip Susi Wed, 15 Nov 2006 14:14:38 -0500 + defrag (0.73pjm1-8) unstable; urgency=low * ext3-notwork.dpatch: reverse testcase (Closes: #310800) diff -u defrag-0.73pjm1/debian/patches/00list defrag-0.73pjm1/debian/patches/00list --- defrag-0.73pjm1/debian/patches/00list +++ defrag-0.73pjm1/debian/patches/00list @@ -4,8 +4,11 @@ -ext3-notwork frag-manpage local-minix-h need-string-h vararg-macro-fix xdump-prog-name non-i386 -gcc-4.0 \ No newline at end of file +gcc-4.0 +fix-ctime-warnings +handle-reserved-inodes +allow-ext3-journal-move +boost-pool-size only in patch2: unchanged: --- defrag-0.73pjm1.orig/debian/patches/boost-pool-size.dpatch +++ defrag-0.73pjm1/debian/patches/boost-pool-size.dpatch @@ -0,0 +1,34 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## boost-pool-size.dpatch by +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Increases the default buffer pool size from 2 MB to 32 MB for dramatic +## DP: speed increase on modern machines with plenty of RAM + +@DPATCH@ +diff -urNad defrag-0.73pjm1~/buffers.c defrag-0.73pjm1/buffers.c +--- defrag-0.73pjm1~/buffers.c 2006-11-16 15:26:36.000000000 -0500 ++++ defrag-0.73pjm1/buffers.c 2006-11-16 16:43:22.000000000 -0500 +@@ -42,7 +42,7 @@ + */ + + static char tmps[128]; +-int pool_size = 512; ++int pool_size = 8192; + Buffer *pool; + Buffer *first_free_buffer; + static Buffer **select_set; +diff -urNad defrag-0.73pjm1~/defrag.8 defrag-0.73pjm1/defrag.8 +--- defrag-0.73pjm1~/defrag.8 2001-07-04 07:08:13.000000000 -0400 ++++ defrag-0.73pjm1/defrag.8 2006-11-16 16:47:09.000000000 -0500 +@@ -148,8 +148,8 @@ + pool. These buffers are used when relocating data, so the more + buffers allocated, the more efficient the relocation process. The + number you choose will depend on how much physical and virtual memory +-you have available. The default pool size is 512 buffers (equivalent +-to 2MB of memory used for filesystems with the default 4kB block ++you have available. The default pool size is 8192 buffers (equivalent ++to 32MB of memory used for filesystems with the default 4kB block + size of current mke2fs versions). + .SH "SEE ALSO" + .BR mkfs (8), only in patch2: unchanged: --- defrag-0.73pjm1.orig/debian/patches/fix-ctime-warnings.dpatch +++ defrag-0.73pjm1/debian/patches/fix-ctime-warnings.dpatch @@ -0,0 +1,71 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## fix-ctime-warnings.dpatch by +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Use local time_t variables rather than casting a u32 * to +## DP: time_t *, which causes warnings and trouble if time_t +## DP: is not 32 bits + +@DPATCH@ +diff -urNad defrag-0.73pjm1~/e2dump.c defrag-0.73pjm1/e2dump.c +--- defrag-0.73pjm1~/e2dump.c 2006-11-15 14:26:18.000000000 -0500 ++++ defrag-0.73pjm1/e2dump.c 2006-11-15 14:27:08.000000000 -0500 +@@ -449,6 +449,7 @@ + + static void dump_super(void) + { ++ time_t t; + printf("SUPERBLOCK:\n"); + printf("Inodes count:%lu\n", + (unsigned long) s.s_inodes_count); /* Inodes count */ +@@ -470,10 +471,12 @@ + (unsigned long) s.s_frags_per_group); /* # Fragments per group */ + printf("Inodes per group:%lu\n", + (unsigned long) s.s_inodes_per_group); /* # Inodes per group */ ++ t = s.s_mtime; + printf("mount time:%s", +- ctime ((time_t *) &s.s_mtime)); /* Mount time */ ++ ctime (&t)); /* Mount time */ ++ t = s.s_wtime; + printf("write time:%s", +- ctime ((time_t *) &s.s_wtime)); /* Write time */ ++ ctime (&t)); /* Write time */ + printf("magic:0x%X", s.s_magic); /* Magic signature */ + if (s.s_magic == EXT2_SUPER_MAGIC) printf(" (OK)\n"); + else printf(" (???) "); +@@ -488,6 +491,7 @@ + those when on a 64-bit system, though that requires some autoconf magic + to find the right printf directive. */ + struct ext2_inode n; ++ time_t t; + + printf("\nINODE %lu\n", (unsigned long) inode_no); + load_inode(&n,inode_no); +@@ -503,9 +507,12 @@ + printf("Owner Uid %d ",(uint) n.i_uid); + printf("Group Id %d\n",(uint) n.i_gid); + printf("File size %lu\n", (unsigned long) n.i_size); +- printf("Access time : %s", ctime ((time_t *) &n.i_atime)); +- printf("Creation time : %s", ctime ((time_t *) &n.i_ctime)); +- printf("Modification time: %s", ctime ((time_t *) &n.i_mtime)); ++ t = n.i_atime; ++ printf("Access time : %s", ctime (&t)); ++ t = n.i_ctime; ++ printf("Creation time : %s", ctime (&t)); ++ t = n.i_mtime; ++ printf("Modification time: %s", ctime (&t)); + if (inode_is_busy(inode_no)) { + if (n.i_dtime!=0) printf("ERROR: bitmap is 1 "); + } +@@ -513,7 +520,10 @@ + if (n.i_dtime==0 && n.i_ctime!=0) printf("ERROR: bitmap is 0\n "); + + if (n.i_dtime!=0) +- printf("Deletion time : %s", ctime ((time_t *) &n.i_dtime)); ++ { ++ t = n.i_dtime; ++ printf("Deletion time : %s", ctime (&t)); ++ } + printf("Links count: %d\n", (uint) n.i_links_count); + /* in 512 byte blocks for some unknown reason */ + printf("512-Blocks count: %lu\n", (unsigned long) n.i_blocks); only in patch2: unchanged: --- defrag-0.73pjm1.orig/debian/patches/handle-reserved-inodes.dpatch +++ defrag-0.73pjm1/debian/patches/handle-reserved-inodes.dpatch @@ -0,0 +1,65 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## handle-reserved-inodes.dpatch by +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: This patch fixes a bug where reserved inodes ( like the ext3 +## DP: journal inode ) would have their indirect blocks optimized +## DP: but not saved, causing filesystem corruption + +@DPATCH@ +diff -urNad defrag-0.73pjm1~/defrag.c defrag-0.73pjm1/defrag.c +--- defrag-0.73pjm1~/defrag.c 2006-11-16 15:26:48.000000000 -0500 ++++ defrag-0.73pjm1/defrag.c 2006-11-16 15:27:22.000000000 -0500 +@@ -409,6 +409,8 @@ + { + if (debug) + printf ("DEBUG: read_fixed_zones()\n"); ++ /* Initialise the inode order. */ ++ inode_order_map[used_inodes++] = ROOT_INO; + if (bad_block_inode) { + if (!inode_in_use (bad_block_inode)) + die ("The badblock inode is on the free list."); +@@ -416,7 +418,9 @@ + die ("Can't read bad block inode."); + + walk_inode(&inode_buffer, WZ_FIXED_BLOCKS); ++ inode_order_map[used_inodes++] = bad_block_inode; + } ++ + #if FS_IS_ext2 + { + /* Reserved blocks don't count as bad blocks */ +@@ -431,8 +435,10 @@ + die ("Reserved inode is on the free list."); + if (get_inode(i)) + die ("Can't read reserved inode."); +- ++ if( debug ) ++ printf( "DEBUG: Adding inode %u to bad block list\n", i ); + walk_inode(&inode_buffer, WZ_FIXED_BLOCKS); ++ inode_order_map[used_inodes++] = i; + } + badblocks = tmp; + } +@@ -527,7 +533,7 @@ + printf ("DEBUG: scan_used_inodes()\n"); + if (verbose) + stat_line ("Scanning inode zones..."); +- for (i=1; i<=INODES; i++) { ++ for (i=FIRST_USER_INODE; i<=INODES; i++) { + if (inode_in_use(i) && (i != bad_block_inode)) + optimise_inode(i, 1); + /* Update at least 50 times during scan */ +@@ -674,12 +680,6 @@ + if (verbose) + stat_line ("Sorting inodes..."); + +- /* Initialise the inode order. */ +- used_inodes = 0; +- inode_order_map[used_inodes++] = ROOT_INO; +- if (bad_block_inode) +- inode_order_map[used_inodes++] = bad_block_inode; +- + for (i = FIRST_USER_INODE; i <= INODES; i++) + { + if (inode_in_use(i)) only in patch2: unchanged: --- defrag-0.73pjm1.orig/debian/patches/allow-ext3-journal-move.dpatch +++ defrag-0.73pjm1/debian/patches/allow-ext3-journal-move.dpatch @@ -0,0 +1,70 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## allow-ext3-journal-move.dpatch by +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: This patch allows defrag to move the ext3 journal + +@DPATCH@ +diff -urNad defrag-0.73pjm1~/defrag.c defrag-0.73pjm1/defrag.c +--- defrag-0.73pjm1~/defrag.c 2006-11-16 16:03:01.000000000 -0500 ++++ defrag-0.73pjm1/defrag.c 2006-11-16 16:03:01.000000000 -0500 +@@ -52,7 +52,7 @@ + int readonly = 0; + int changed = 0; + int blocks_until_sync = 0; +-Block bad_block_inode = 0, user_bad_inode = 0; ++Block bad_block_inode = 0, user_bad_inode = 0, journal_inode; + + #ifndef FS_IS_ext2 + Block next_block_to_fill = 0; +@@ -77,6 +77,8 @@ + static int used_inodes = 0; + static FILE *priority_file = 0; + ++static void optimise_inode (unsigned int i, int scan); ++ + /* Write back the current inode */ + void put_inode(void) + { +@@ -420,6 +422,11 @@ + walk_inode(&inode_buffer, WZ_FIXED_BLOCKS); + inode_order_map[used_inodes++] = bad_block_inode; + } ++ if (journal_inode) { ++ optimise_inode(journal_inode, 1); ++ inode_order_map[used_inodes++] = journal_inode; ++ } ++ + + #if FS_IS_ext2 + { +@@ -429,7 +436,8 @@ + + for (i=1; i < FIRST_USER_INODE; i++) { + if ((i == EXT2_ROOT_INO) || /* Allow optimization of root */ +- (i == bad_block_inode)) /* Done with them already */ ++ (i == bad_block_inode) || /* Done with them already */ ++ (i == journal_inode)) + continue; + if (!inode_in_use (i)) + die ("Reserved inode is on the free list."); +diff -urNad defrag-0.73pjm1~/ext2.c defrag-0.73pjm1/ext2.c +--- defrag-0.73pjm1~/ext2.c 2006-11-16 16:03:01.000000000 -0500 ++++ defrag-0.73pjm1/ext2.c 2006-11-16 16:03:51.000000000 -0500 +@@ -49,6 +49,7 @@ + #define bm_mark_zone(x) (setbit(zone_map,(x)-FIRSTZONE),changed=1) + #define bm_unmark_zone(x) (clrbit(zone_map,(x)-FIRSTZONE),changed=1) + ++extern Block journal_inode; + + /** @postcondition E1: Super.s_inodes_per_group % 8 == 0. + @postcondition E2: Super.s_blocks_per_group % 8 == 0. +@@ -118,6 +119,8 @@ + | EXT2_FEATURE_INCOMPAT_FILETYPE))) + die( "filesystem has unsupported features"); + ++ if(Super.s_feature_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL) ++ journal_inode = 8; + block_size = EXT2_MIN_BLOCK_SIZE << Super.s_log_block_size; + + groups = (Super.s_blocks_count - Super.s_first_data_block +