Re: [PATCH] ext4: Fix small file fragmentation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 14, 2008 at 07:18:17PM -0400, Theodore Tso wrote:
> On Thu, Aug 14, 2008 at 11:14:40PM +0530, Aneesh Kumar K.V wrote:
> > mballoc small file block allocation use per cpu prealloc
> > space. Use goal block when searching for the right prealloc
> > space. Also make sure ext4_da_writepages tries to write
> > all the pages for small files in single attempt
> 
> Hi Aneesh, how are you testing your patch?  I've created the following
> shell script:
> 
> -------------------------------
> #!/bin/sh
> #
> # small-files-frag-test --- test for small files fragmentation
> 
> DEVICE=/dev/thunk/testbench
> 
> mke2fs -t ext4dev $DEVICE
> mount -t ext4dev $DEVICE /mnt
> tar -C /usr -cf - bin lib | tar -C /mnt -xpf - 
> sync; sleep 5
> umount $DEVICE
> e2fsck -nfv -E fragcheck $DEVICE
> -------------------------------
> 
> ... and the results show roughly the same amount of fragmentation, and the
> same pattern.  In fact, it's a ltitle worse (30% vs 25%).
> 
>    37912 inodes used (11.57%)
>    11468 non-contiguous inodes (30.2%)
>          # of inodes with ind/dind/tind blocks: 0/0/0
>          Extent depth histogram: 32638/5
>   711894 blocks used (54.31%)
> 


I have better results with the below patch on top of the patch i sent.

   21156 inodes used (0.47%)
     158 non-contiguous inodes (0.7%)
         # of inodes with ind/dind/tind blocks: 4/4/4
  581216 blocks used (3.24%)
       0 bad blocks
       1 large file

commit 6ad9d25595aea8efa0d45c0a2dd28b4a415e34e6
Author: Aneesh Kumar K.V <aneesh.kumar@xxxxxxxxxxxxxxxxxx>
Date:   Fri Aug 15 23:19:15 2008 +0530

    move the dirty inodes to the end of the list

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 1afcb11..650b021 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -4258,7 +4258,8 @@ ext4_mb_discard_lg_preallocations(struct super_block *sb,
 
 static void ext4_mb_add_n_trim(struct ext4_allocation_context *ac)
 {
-	int order, added = 0, lg_prealloc_count = 1;
+	int order, lg_prealloc_count = 1;
+	bool added = 0;
 	struct super_block *sb = ac->ac_sb;
 	struct ext4_locality_group *lg = ac->ac_lg;
 	struct ext4_prealloc_space *tmp_pa, *pa = ac->ac_pa;
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 25adfc3..95eee62 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -163,7 +163,7 @@ void __mark_inode_dirty(struct inode *inode, int flags)
 		 */
 		if (!was_dirty) {
 			inode->dirtied_when = jiffies;
-			list_move(&inode->i_list, &sb->s_dirty);
+			list_move_tail(&inode->i_list, &sb->s_dirty);
 		}
 	}
 out:
@@ -208,7 +208,7 @@ static void redirty_tail(struct inode *inode)
  */
 static void requeue_io(struct inode *inode)
 {
-	list_move(&inode->i_list, &inode->i_sb->s_more_io);
+	list_move_tail(&inode->i_list, &inode->i_sb->s_more_io);
 }
 
 static void inode_sync_complete(struct inode *inode)

Attachment: out.bz2
Description: Binary data


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux