Akinobu Mita | 9 Sep 2005 10:42
Favicon

[PATCH 0/6] jbd cleanup

The following 6 patches cleanup the jbd code and kill about 200 lines. 
First of 4 patches can apply to 2.6.13-git8 and 2.6.13-mm2.
The rest of them can apply to 2.6.13-mm2.

 fs/jbd/checkpoint.c          |  179 +++++++++++--------------------------------
 fs/jbd/commit.c              |  101 ++++++++++--------------
 fs/jbd/journal.c             |   11 +-
 fs/jbd/revoke.c              |  158 ++++++++++++++-----------------------
 fs/jbd/transaction.c         |  113 +++++----------------------
 include/linux/jbd.h          |   28 +++---
 include/linux/journal-head.h |    4 
 7 files changed, 201 insertions(+), 393 deletions(-)

Akinobu Mita | 9 Sep 2005 10:43
Favicon

[PATCH 1/6] jbd: remove duplicated debug print

remove duplicated debug print

Signed-off-by: Akinobu Mita <mita <at> miraclelinux.com>

---

 commit.c |    2 --
 1 files changed, 2 deletions(-)

--- 2.6-mm/fs/jbd/commit.c.orig	2005-09-02 00:53:49.000000000 +0900
+++ 2.6-mm/fs/jbd/commit.c	2005-09-02 00:54:11.000000000 +0900
 <at>  <at>  -425,8 +425,6  <at>  <at>  write_out_data:

 	journal_write_revoke_records(journal, commit_transaction);

-	jbd_debug(3, "JBD: commit phase 2\n");
-
 	/*
 	 * If we found any dirty or locked buffers, then we should have
 	 * looped back up to the write_out_data label.  If there weren't
Akinobu Mita | 9 Sep 2005 10:44
Favicon

[PATCH 2/6] jbd: use hlist for the revoke tables

use struct hlist_head and hlist_node for the revoke tables.

Signed-off-by: Akinobu Mita <mita <at> miraclelinux.com>

---

 revoke.c |   56 ++++++++++++++++++++++++++------------------------------
 1 files changed, 26 insertions(+), 30 deletions(-)

diff -Nurp 2.6.13-mm1.old/fs/jbd/revoke.c 2.6.13-mm1/fs/jbd/revoke.c
--- 2.6.13-mm1.old/fs/jbd/revoke.c	2005-09-04 21:46:35.000000000 +0900
+++ 2.6.13-mm1/fs/jbd/revoke.c	2005-09-04 21:50:25.000000000 +0900
 <at>  <at>  -79,7 +79,7  <at>  <at>  static kmem_cache_t *revoke_table_cache;

 struct jbd_revoke_record_s 
 {
-	struct list_head  hash;
+	struct hlist_node hash;
 	tid_t		  sequence;	/* Used for recovery only */
 	unsigned long	  blocknr;
 };
 <at>  <at>  -92,7 +92,7  <at>  <at>  struct jbd_revoke_table_s
 	 * for recovery.  Must be a power of two. */
 	int		  hash_size; 
 	int		  hash_shift; 
-	struct list_head *hash_table;
+	struct hlist_head *hash_table;
 };

 
(Continue reading)

Akinobu Mita | 9 Sep 2005 10:46
Favicon

[PATCH 3/6] jbd: cleanup for initializing/destroying the revoke tables

use loop counter for initializing/destroying a pair of the revoke tables.

Signed-off-by: Akinobu Mita <mita <at> miraclelinux.com>

---

 revoke.c |  116 ++++++++++++++++++++++-----------------------------------------
 1 files changed, 42 insertions(+), 74 deletions(-)

diff -X 2.6.13-mm1/Documentation/dontdiff -Nurp 2.6.13-mm1.old/fs/jbd/revoke.c 2.6.13-mm1/fs/jbd/revoke.c
--- 2.6.13-mm1.old/fs/jbd/revoke.c	2005-09-05 03:21:00.000000000 +0900
+++ 2.6.13-mm1/fs/jbd/revoke.c	2005-09-05 11:16:04.000000000 +0900
 <at>  <at>  -193,108 +193,76  <at>  <at>  void journal_destroy_revoke_caches(void)

 int journal_init_revoke(journal_t *journal, int hash_size)
 {
-	int shift, tmp;
+	int shift = 0;
+	int tmp = hash_size;
+	int i;

+	/* Check that the hash_size is a power of two */
+	J_ASSERT ((hash_size & (hash_size-1)) == 0);
 	J_ASSERT (journal->j_revoke_table[0] == NULL);

-	shift = 0;
-	tmp = hash_size;
-	while((tmp >>= 1UL) != 0UL)
+	while ((tmp >>= 1UL) != 0UL)
 		shift++;
(Continue reading)

Akinobu Mita | 9 Sep 2005 10:47
Favicon

[PATCH 4/6] jbd: use list_head for the list of buffers on a transaction's data

use struct list_head for doubly-linked list of buffers on a transaction's
data, metadata or forget queue.

Signed-off-by: Akinobu Mita <mita <at> miraclelinux.com>

---

 fs/jbd/checkpoint.c          |   12 ++--
 fs/jbd/commit.c              |   79 ++++++++++++++++--------------
 fs/jbd/journal.c             |    1 
 fs/jbd/transaction.c         |  110 ++++++++-----------------------------------
 include/linux/jbd.h          |   20 +++----
 include/linux/journal-head.h |    2 
 6 files changed, 80 insertions(+), 144 deletions(-)

diff -X 2.6.13-mm1/Documentation/dontdiff -Nurp 2.6.13-mm1.old/fs/jbd/checkpoint.c 2.6.13-mm1/fs/jbd/checkpoint.c
--- 2.6.13-mm1.old/fs/jbd/checkpoint.c	2005-09-05 03:15:17.000000000 +0900
+++ 2.6.13-mm1/fs/jbd/checkpoint.c	2005-09-05 03:15:35.000000000 +0900
 <at>  <at>  -684,12 +684,12  <at>  <at>  void __journal_drop_transaction(journal_
 	}

 	J_ASSERT(transaction->t_state == T_FINISHED);
-	J_ASSERT(transaction->t_buffers == NULL);
-	J_ASSERT(transaction->t_sync_datalist == NULL);
-	J_ASSERT(transaction->t_forget == NULL);
-	J_ASSERT(transaction->t_iobuf_list == NULL);
-	J_ASSERT(transaction->t_shadow_list == NULL);
-	J_ASSERT(transaction->t_log_list == NULL);
+	J_ASSERT(list_empty(&transaction->t_metadata_list));
+	J_ASSERT(list_empty(&transaction->t_syncdata_list));
(Continue reading)

Akinobu Mita | 9 Sep 2005 10:48
Favicon

[-mm PATCH 5/6] jbd: use list_head for the list of all transactions waiting for

use struct list_head for a linked circular list of all transactions
waiting for checkpointing on a journal control structure.

Signed-off-by: Akinobu Mita <mita <at> miraclelinux.com>

---

 fs/jbd/checkpoint.c  |   48 ++++++++++++++++++++----------------------------
 fs/jbd/commit.c      |   16 ++--------------
 fs/jbd/journal.c     |    9 +++++----
 fs/jbd/transaction.c |    1 +
 include/linux/jbd.h  |    4 ++--
 5 files changed, 30 insertions(+), 48 deletions(-)

diff -X 2.6.13-mm1/Documentation/dontdiff -Nurp 2.6.13-mm1.old/fs/jbd/checkpoint.c 2.6.13-mm1/fs/jbd/checkpoint.c
--- 2.6.13-mm1.old/fs/jbd/checkpoint.c	2005-09-04 23:31:48.000000000 +0900
+++ 2.6.13-mm1/fs/jbd/checkpoint.c	2005-09-05 00:23:28.000000000 +0900
 <at>  <at>  -180,8 +180,10  <at>  <at>  static void __wait_cp_io(journal_t *jour
 	this_tid = transaction->t_tid;
 restart:
 	/* Didn't somebody clean up the transaction in the meanwhile */
-	if (journal->j_checkpoint_transactions != transaction ||
-		transaction->t_tid != this_tid)
+	if (list_empty(&journal->j_checkpoint_transactions) ||
+	    list_entry(journal->j_checkpoint_transactions.next, transaction_t,
+			t_cplist) != transaction ||
+	    transaction->t_tid != this_tid)
 		return;
 	while (!released && transaction->t_checkpoint_io_list) {
 		jh = transaction->t_checkpoint_io_list;
(Continue reading)

Akinobu Mita | 9 Sep 2005 10:50
Favicon

[-mm PATCH 6/6] jbd: use list_head for a transaction checkpoint list

use struct list_head for doubly-linked list of buffers still remaining to be
flushed before an old transaction can be checkpointed.

Signed-off-by: Akinobu Mita <mita <at> miraclelinux.com>

---

 fs/jbd/checkpoint.c          |  119 +++++++------------------------------------
 fs/jbd/commit.c              |    4 -
 fs/jbd/journal.c             |    1 
 fs/jbd/transaction.c         |    2 
 include/linux/jbd.h          |    4 -
 include/linux/journal-head.h |    2 
 6 files changed, 30 insertions(+), 102 deletions(-)

diff -X 2.6.13-mm1/Documentation/dontdiff -Nurp 2.6.13-mm1.old/fs/jbd/checkpoint.c 2.6.13-mm1/fs/jbd/checkpoint.c
--- 2.6.13-mm1.old/fs/jbd/checkpoint.c	2005-09-05 03:21:20.000000000 +0900
+++ 2.6.13-mm1/fs/jbd/checkpoint.c	2005-09-05 03:21:33.000000000 +0900
 <at>  <at>  -22,71 +22,7  <at>  <at> 
 #include <linux/jbd.h>
 #include <linux/errno.h>
 #include <linux/slab.h>
-
-/*
- * Unlink a buffer from a transaction checkpoint list.
- *
- * Called with j_list_lock held.
- */
-
-static void __buffer_unlink_first(struct journal_head *jh)
(Continue reading)

Andrew Morton | 9 Sep 2005 11:15

Re: [PATCH 0/6] jbd cleanup

Akinobu Mita <mita <at> miraclelinux.com> wrote:
>
> The following 6 patches cleanup the jbd code and kill about 200 lines. 
>

Thanks, but I'm not inclined to apply them.

a) Maybe 70-80% of the Linux world uses this filesystem.  We need to be
   very cautious in making changes to it.

b) A relatively large number of people are carrying quite large
   out-of-tree patches, some of which they're hoping to merge sometime. 
   Admittedly more against ext3 than JBD, but there is potential here to
   cause those people trouble.

Plus the switch to list_heads in journal_s has some impact on type safety
and debuggability - I considered doing it years ago but decided not to
because I found I _used_ those pointers fairly commonly in development. 
list_heads are a bit of a pain in gdb (kgdb and kernel core dumps), for
example.

Theodore Ts'o | 9 Sep 2005 20:16
Picon
Picon
Favicon
Gravatar

Re: [PATCH 1/6] jbd: remove duplicated debug print

On Fri, Sep 09, 2005 at 05:43:42PM +0900, Akinobu Mita wrote:
> remove duplicated debug print

> -	jbd_debug(3, "JBD: commit phase 2\n");
> -

If you're going to do this, please renumber the rest of the "commit
phase n" messages.  Or the debugging messages will look very funny.

						- Ted
Akinobu Mita | 10 Sep 2005 16:36
Favicon

Re: [PATCH 1/6] jbd: remove duplicated debug print

On Fri, Sep 09, 2005 at 02:16:49PM -0400, Theodore Ts'o wrote:
> On Fri, Sep 09, 2005 at 05:43:42PM +0900, Akinobu Mita wrote:
> > remove duplicated debug print
> 
> > -	jbd_debug(3, "JBD: commit phase 2\n");
> > -
> 
> If you're going to do this, please renumber the rest of the "commit
> phase n" messages.  Or the debugging messages will look very funny.

The second duplicated "commit phase 2" only does:

 	J_ASSERT (commit_transaction->t_sync_datalist == NULL);

So I thought it might be accidentaly inserted.
diff -U 9 :

--- ./fs/jbd/commit.c.orig	2005-09-10 22:09:05.000000000 +0900
+++ ./fs/jbd/commit.c	2005-09-10 22:09:25.000000000 +0900
 <at>  <at>  -419,20 +419,18  <at>  <at>  write_out_data:
 		cond_resched_lock(&journal->j_list_lock);
 	}
 	spin_unlock(&journal->j_list_lock);

 	if (err)
 		__journal_abort_hard(journal);

 	journal_write_revoke_records(journal, commit_transaction);

-	jbd_debug(3, "JBD: commit phase 2\n");
(Continue reading)


Gmane