public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mingming Cao <cmm@us.ibm.com>
To: Mingming Cao <cmm@us.ibm.com>
Cc: Andrew Morton <akpm@osdl.org>,
	tytso@mit.edu, pbadari@us.ibm.com, linux-kernel@vger.kernel.org,
	ext2-devel@lists.sourceforge.net
Subject: [PATCH 4/4] ext3 block reservation patch set -- dynamically increase reservation window
Date: 13 Apr 2004 18:00:27 -0700	[thread overview]
Message-ID: <1081904429.3548.6850.camel@localhost.localdomain> (raw)
In-Reply-To: <1081903949.3548.6837.camel@localhost.localdomain>

[-- Attachment #1: Type: text/plain, Size: 518 bytes --]

> [patch 4]ext3_rsv_dw.patch: adjust the reservation window size
> dynamically:
> 	Start from the deault reservation window size, if the hit ration 	of
> the reservation window is more than 50%, we will double the 	reservation
> window size next time up to a certain upper limit.

diffstat ext3_rsv_dw.patch
 fs/ext3/balloc.c          |   13 ++++++++++++-
 fs/ext3/ialloc.c          |    3 ++-
 fs/ext3/super.c           |    1 +
 include/linux/ext3_fs_i.h |    1 +
 4 files changed, 16 insertions(+), 2 deletions(-)


[-- Attachment #2: ext3_rsv_dw.patch --]
[-- Type: text/x-patch, Size: 2912 bytes --]

diff -urNp 264-rsv-cleanup-base-mount/fs/ext3/balloc.c 264-rsv-cleanup-base-mount-dw/fs/ext3/balloc.c
--- 264-rsv-cleanup-base-mount/fs/ext3/balloc.c	2004-04-13 01:44:50.091477008 -0700
+++ 264-rsv-cleanup-base-mount-dw/fs/ext3/balloc.c	2004-04-12 22:15:12.128618008 -0700
@@ -148,6 +148,7 @@ static inline void rsv_window_remove(str
 {
 		rsv->rsv_start = 0;
 		rsv->rsv_end = 0;
+		rsv->rsv_alloc_hit = 0;
 		list_del(&rsv->rsv_list);
 		INIT_LIST_HEAD(&rsv->rsv_list);
 }
@@ -548,7 +549,8 @@ repeat:
 			goto fail_access;
 		goto repeat;
 	}
-
+	if (my_rsv)
+		my_rsv->rsv_alloc_hit++;
 	return goal;
 fail_access:
 	return -1;
@@ -731,6 +733,15 @@ static int alloc_new_reservation(struct 
 			start_block = my_rsv->rsv_end + 1;
 		search_head = list_entry(my_rsv->rsv_list.prev, 
 				struct reserve_window, rsv_list);
+		if ((my_rsv->rsv_alloc_hit > (my_rsv->rsv_end - my_rsv->rsv_start + 1) / 2)) {
+			/* 
+			 * if we previously allocation hit ration is greater than half
+			 * we double the size of reservation window next time
+			 * otherwise keep the same
+			 */
+			size = size * 2;
+			atomic_set(&my_rsv->rsv_goal_size, size);
+		}
 		rsv_window_remove(my_rsv);
 	}
 	else {
diff -urNp 264-rsv-cleanup-base-mount/fs/ext3/ialloc.c 264-rsv-cleanup-base-mount-dw/fs/ext3/ialloc.c
--- 264-rsv-cleanup-base-mount/fs/ext3/ialloc.c	2004-04-10 01:19:52.705503744 -0700
+++ 264-rsv-cleanup-base-mount-dw/fs/ext3/ialloc.c	2004-04-12 21:46:19.443026256 -0700
@@ -583,8 +583,9 @@ got:
 	ei->i_dir_acl = 0;
 	ei->i_dtime = 0;
 	ei->i_rsv_window.rsv_start = 0;
-	ei->i_rsv_window.rsv_end= 0;
+	ei->i_rsv_window.rsv_end = 0;
 	atomic_set(&ei->i_rsv_window.rsv_goal_size, EXT3_DEFAULT_RESERVE_BLOCKS);
+	ei->i_rsv_window.rsv_alloc_hit = 0;
 	INIT_LIST_HEAD(&ei->i_rsv_window.rsv_list);
 	ei->i_block_group = group;
 
diff -urNp 264-rsv-cleanup-base-mount/fs/ext3/super.c 264-rsv-cleanup-base-mount-dw/fs/ext3/super.c
--- 264-rsv-cleanup-base-mount/fs/ext3/super.c	2004-04-10 01:19:52.719501616 -0700
+++ 264-rsv-cleanup-base-mount-dw/fs/ext3/super.c	2004-04-12 21:47:00.612767504 -0700
@@ -1312,6 +1312,7 @@ static int ext3_fill_super (struct super
 	INIT_LIST_HEAD(&sbi->s_rsv_window_head.rsv_list);
 	sbi->s_rsv_window_head.rsv_start = 0;
 	sbi->s_rsv_window_head.rsv_end = 0;
+	sbi->s_rsv_window_head.rsv_alloc_hit = 0;
 	atomic_set(&sbi->s_rsv_window_head.rsv_goal_size, 0);
 
 	/*
diff -urNp 264-rsv-cleanup-base-mount/include/linux/ext3_fs_i.h 264-rsv-cleanup-base-mount-dw/include/linux/ext3_fs_i.h
--- 264-rsv-cleanup-base-mount/include/linux/ext3_fs_i.h	2004-04-10 01:19:52.723501008 -0700
+++ 264-rsv-cleanup-base-mount-dw/include/linux/ext3_fs_i.h	2004-04-12 21:43:25.019542656 -0700
@@ -23,6 +23,7 @@ struct reserve_window{
 	__u32			rsv_start;
 	__u32			rsv_end;
 	atomic_t		rsv_goal_size;
+	__u32			rsv_alloc_hit;
 };
 
 /*

  parent reply	other threads:[~2004-04-14  0:54 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200403190846.56955.pbadari@us.ibm.com>
     [not found] ` <20040321015746.14b3c0dc.akpm@osdl.org>
2004-03-30  8:55   ` [RFC, PATCH] Reservation based ext3 preallocation Mingming Cao
2004-03-30  9:45     ` Andrew Morton
2004-03-30 17:07       ` Badari Pulavarty
2004-03-30 17:12         ` [Ext2-devel] " Alex Tomas
2004-03-30 18:07           ` Badari Pulavarty
2004-03-30 18:23         ` Mingming Cao
2004-03-30 18:36         ` Andrew Morton
2004-04-03  1:45       ` [Ext2-devel] " Mingming Cao
2004-04-03  1:50         ` Andrew Morton
2004-04-03  2:37           ` Mingming Cao
2004-04-03  2:50             ` Andrew Morton
2004-04-05 16:49               ` Mingming Cao
2004-04-14  0:52               ` [PATCH 0/4] ext3 block reservation patch set Mingming Cao
2004-04-14  0:54                 ` [PATCH 1/4] ext3 block reservation patch set -- ext3 preallocation cleanup Mingming Cao
2004-04-14  0:57                 ` [PATCH 2/4] ext3 block reservation patch set --ext3 block reservation Mingming Cao
2004-04-14  0:58                 ` [PATCH 3/4] ext3 block reservation patch set --mount and ioctl feature Mingming Cao
2004-04-14  1:00                 ` Mingming Cao [this message]
2004-04-14  2:47                 ` [PATCH 0/4] ext3 block reservation patch set Andrew Morton
2004-04-14 16:11                   ` Badari Pulavarty
2004-04-14 17:44                     ` Mingming Cao
2004-04-14 23:02                     ` Andrew Morton
2004-04-14 23:12                       ` Badari Pulavarty
2004-04-14 16:42                   ` Badari Pulavarty
2004-04-14 17:30                   ` Mingming Cao
2004-04-14 23:07                     ` Andrew Morton
2004-04-14 23:42                       ` Mingming Cao
2004-04-21 23:34                       ` [PATCH] Lazy discard ext3 reservation window patch Mingming Cao
2004-04-27 15:19                 ` [PATCH 0/4] ext3 block reservation patch set Mary Edie Meredith

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1081904429.3548.6850.camel@localhost.localdomain \
    --to=cmm@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=ext2-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbadari@us.ibm.com \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox