[Patch 8/8] 2.4: Fix flushtime ordering on BUF_DIRTY list

From: Stephen Tweedie (sct@redhat.com)
Date: Tue Mar 25 2003 - 12:39:40 EST


[From Andrew Morton.] Set the flushtime on committing buffers when they
are actually sent to the dirty list, not when they are first dirtied.
Avoids some starvation scenarios when the flushtimes on BUF_DIRTY get
out-of-order.

--- linux-2.4-ext3push/fs/jbd/transaction.c.=K0007=.orig 2003-03-25 10:59:15.000000000 +0000
+++ linux-2.4-ext3push/fs/jbd/transaction.c 2003-03-25 10:59:15.000000000 +0000
@@ -1138,7 +1138,6 @@ int journal_dirty_metadata (handle_t *ha
         
         spin_lock(&journal_datalist_lock);
         set_bit(BH_JBDDirty, &bh->b_state);
- set_buffer_flushtime(bh);
 
         J_ASSERT_JH(jh, jh->b_transaction != NULL);
         
@@ -2090,6 +2089,13 @@ void journal_file_buffer(struct journal_
         spin_unlock(&journal_datalist_lock);
 }
 
+static void jbd_refile_buffer(struct buffer_head *bh)
+{
+ if (buffer_dirty(bh) && (bh->b_list != BUF_DIRTY))
+ set_buffer_flushtime(bh);
+ refile_buffer(bh);
+}
+
 /*
  * Remove a buffer from its current buffer list in preparation for
  * dropping it from its current transaction entirely. If the buffer has
@@ -2110,7 +2116,7 @@ void __journal_refile_buffer(struct jour
                 __journal_unfile_buffer(jh);
                 jh->b_transaction = NULL;
                 /* Onto BUF_DIRTY for writeback */
- refile_buffer(jh2bh(jh));
+ jbd_refile_buffer(jh2bh(jh));
                 return;
         }
         
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Mar 31 2003 - 22:00:20 EST